Git: Renaming a release tag

Often you meet with the problem with a release tag, prepared in haste. It can be renamed in a few simple steps. The damage caused due to this may vary. Application can range from – correcting typos to making tag compatible with tools like composer.
* Erroneous release tag
+ tag_old = old tag
+ tag_new = new tag (required)
* The approach is pretty simple.
$ git tag tag_new tag_old
$ git tag -d tag_old

That would create a new tag out of the existing one and kill the old one
git push origin :refs/tags/tag_old This will delete the tag in your remote location
git push --tags This will update the new tag in your remote 🙂
Bingo! You are done.
PS: There are alternate ways too.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s