Created
December 11, 2017 15:42
-
-
Save boostup/2fee86c2b2442e69ebbb20204d6d066b to your computer and use it in GitHub Desktop.
GIT: Tag a past commit
This file contains 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
# Set the HEAD to the old commit that we want to tag | |
git checkout 9fceb02 | |
# temporarily set the date to the date of the HEAD commit, and add the tag | |
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" \ | |
git tag -a v1.2 -m"v1.2" | |
# set HEAD back to whatever you want it to be | |
git checkout master | |
# push the new tag | |
git push --tags origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment