Skip to content

Instantly share code, notes, and snippets.

@morgotth
Last active September 15, 2015 09:38
Show Gist options
  • Save morgotth/861f661f571bc70cea42 to your computer and use it in GitHub Desktop.
Save morgotth/861f661f571bc70cea42 to your computer and use it in GitHub Desktop.
Edit tag messages and preserving original date
for tag in $(git tag -l);do
# Checkout this tag
git co $tag > /dev/null
# Retrieve tag date
GIT_COMMITTER_DATE=$(git sh $tag | head -n 3 | tail -n 1 | cut -c 9-);
echo "$tag: $GIT_COMMITTER_DATE"
# Edit tag message but preserving date (TODO: author?)
GIT_COMMITTER_DATE="$GIT_COMMITTER_DATE" git tag $tag -a --force
done
# Overwrite remote tags with:
#git push --force --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment