Heesung Yang

Git Tag Cheatsheet

Add tag

# add tag to latest commit
~$ git tag v1.5.1.2

# add tag to specific commit
~$ git tag v1.5.1.2 446e2c10555ccbaa5cd4006b250d7d2135dbc2b0

Remove tag

# local
~$ git tag -d 1.7.2

# remote
~$ git push origin :tags/1.7.2

Overwrite tag

# local
~$ git tag -f 1.8.0
~$ git tag -f 1.8.0 <commit id>

# remote
~$ git push -f --tags

Push tag to origin

# push specific tag
# git push <remote name> <tag>
~$ git push origin 1.0.0

# push all tags in branch
# git push <remote name> <local branch>
~$ git push origin --tags

Make branch with specific tag

# git checkout -b <branch name> <remote tag name>
~$ git checkout -b version2 2.0.0