28. September 2017

Git Re-tagging is bad

We all know Git does not like to limit you in any direction although in some aspects it should. And because of that freedom there are also some additional possibilities you can do when you want to cover up your own mistakes. This however will not focus on how to properly cover your mistakes as there is basically no way to cover a bad tag.

Git Re-tagging

I know some of the people do not read documentation or want a second source of truth, but manual on git-tag has a whole discussion about re-tagging. It also points out that once the tag is pushed and somebody else pulled it, there is no automated way for you to change that tag for that person (but you can for any fresh pull). Think about what that means. Someone will have TAG_X pointing to commit 123456 while everybody else will have it pointing to commit 567890. How are you going to know which one is real after X years?
Git is a decentralized version control system and while tags are human readable references of commit hashes, they have a special treatment. They have a special command for pushing a tag, special command to list them, etc.
Now before you re-tag and do the insane thing, please read the discussion on the official Git Tag manual.