Skip to content

Instantly share code, notes, and snippets.

@Smenus
Created September 18, 2017 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Smenus/18a9553ef98f28abccc78d7049f1dbc1 to your computer and use it in GitHub Desktop.
Save Smenus/18a9553ef98f28abccc78d7049f1dbc1 to your computer and use it in GitHub Desktop.
git-rename-tag
#!/bin/sh
# I think this is run TAG="oldtag" NEWTAG="newtag" sh git-rename-tag.sh
# It should keep the same date, committer and message as the original tag
fmt='
tagcommit=%(objectname)
tagname=%(taggername)
tagemail=%(taggeremail)
tagdate=%(taggerdate)
tagmessage=%(contents)
GIT_COMMITTER_DATE="$tagdate" GIT_COMMITTER_NAME="$tagname" GIT_COMMITTER_EMAIL="$tagemail" git tag -m "$tagmessage" "$NEWTAG" $tagcommit
git tag -d "$TAG"
'
eval=`git for-each-ref "refs/tags/$TAG" --shell --format="$fmt"`
eval "$eval"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment