git tag v1.0.0-rc1 // will be associated with recent commit
// annotated tag - have Tagger:... info
git tag -a v1.0.0-rc1 -m "I am tag with more detail" (-a -> annotated)
git tag // list tags
git tag -l "v1.0.0*" // search tags
// see particular tag
git show v1.0.0-rc1
Compare Tag
git diff|difftool v1.0.0-alpha v1.0.0-beta
Update Tag
Moving tag to different commit ( may be recent commit )
git tag -a v1.0.0-beta -f(--force) <commit hash>
Remove Tag
git tag v1.0.0-beta --delete
git push origin :v1.0.0-beta :v1.0.0-beta // Removed existing tag from repo
Pushing Tag to github
git push origin --tags // Push all local tags to remote
git push origin --follow-tags // Push only annotated tags to remote
git push origin v1.0.0-rc1 // push only light weight tag
Config to push annotated tag by default ( with commit - git push origin master)
git config --global push.followTags true
Checkout Tag
You need to create a branch to acheive this
git checkout -b my-branch <tag-name>
// Ex- git checkout -b my-branch v1.0.0-alpha
// make changes & commit
git checkout master
git merge my-branch
git branch -d my-branch (delete branch once you are done)