Created
December 18, 2018 12:55
-
-
Save neefrehman/860dc40ed0d818a3d4ffd67fcc55a515 to your computer and use it in GitHub Desktop.
Edit the date of git tags to the dates of the associated commits, while keeping messages for annotated tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git tag -l | while read -r tag ; do COMMIT_HASH=$(git rev-list -1 $tag) COMMIT_MSG=$(git tag -l --format='%(contents)' $tag | head -n1) && GIT_COMMITTER_DATE="$(git show $COMMIT_HASH --format=%aD | head -1)" git tag -a -f $tag -m"$COMMIT_MSG" $COMMIT_HASH ; done | |
$ git tag -l -n1 #check by listing all tags with first line of message | |
$ git push --tags --force #push edited tags up to remote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment