Git Tag Vs Branch how do you explain it?
I had a scenario where I had to explain someone an analogy between Git Tag and Git Branch. I gave the analogy of DNS, If you had to type 192.168.0.1 every time you wanted to visit google.com it would be difficult right? So we came up with a key-value pair called the DNS where we store this google.com -> 192.168.0.1 so you don't have to remember the IP address.
Similarly, a commit is consist of a unique value called commit hash.
The commit message is for your convenience as to what you did with a file. The commit hash is unique but it's random and hard to remember.
In case you want to remember that commit. What do you do?
You tag it.
Tag creates a key-value pair like 9fesa => production
Helps you remember a commit, you may merge branch master may move ahead but commit hash is to tag mapping remains.
In case you rebase that mapping gets lost because the commit hash changed and Git can no longer find that commit for you.
Is this explanation correct? Can I improve further? Would love to know your views.