Skip to content

Instantly share code, notes, and snippets.

@boostup
Created December 11, 2017 15:42
Show Gist options
  • Save boostup/2fee86c2b2442e69ebbb20204d6d066b to your computer and use it in GitHub Desktop.
Save boostup/2fee86c2b2442e69ebbb20204d6d066b to your computer and use it in GitHub Desktop.
GIT: Tag a past commit
# 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