A Quick Sanity Check: Git Tag Cleanup Routine

I mentioned in an earlier post that if you want to move a tag in git you have to do a discrete tag delete, push, then re-add the same tag, push.  Sometimes though there are tags already out of sync in your repo.  To handle things nicely, first do this routine.

Update your local repos with whatever tags are on the remote.  It might not be necessary to do all branches but do the main ones, it’s quick, just to be sure you are synced up.  I’ve seen errors in SourceTree that don’t work that well with git tags so I’m not too trusting.

git checkout develop

git fetch --tags

git checkout master

git fetch --tags

Again remember – if you need to move a tag, delete it, push the change, then recreate it, push the change.  Do the changes separately the tag cannot do a compound move (delete/reassign) in git; and check your remote afterwards.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>