Thursday, 26 April 2018

Move a tag on a git Branch to a Different Commit

You might forget to do something before you tag a commit. Then you realize OMG I gotta make that small change or delete something etc. You would have a new commit after the tag you've just made so you want to move the tag to this new commit. Here is how.

  1. Delete the tag on any remote before you push
    git push origin :refs/tags/<tagname>
    
  2. Replace the tag to reference the most recent commit
    git tag -fa <tagname>
    
  3. Push the tag to the remote origin
    git push --tags

ref:
https://stackoverflow.com/questions/8044583/how-can-i-move-a-tag-on-a-git-branch-to-a-different-commit

No comments:

Post a Comment