Git Tag

The git tag command is for working with branches.

Command Abbreviated Description
git tag list all tags in the current branch
git tag --list -l the same as just doing git tag
git tag --list '1.*' -l filter the list to only output ones starting with "1."
git tag --list 'test*' --ignore-case -i ignore the case of the filter, so list "Test..." and "test..."
git tag 'hello' tag the latest commit on the current branch with 'hello', an annotated tag
git tag 'hello' 7cb90d3ab tag the commit 7cb90d3ab on the current branch with 'hello', an annotated tag
git tag --delete 'hello' -d remove the 'hello' tag
git tag --force 'hello' -f force the replacement of the tag 'hello', rather than fail
git tag 'hello' --message='Hello World' -m add the 'hello' tag with a message

There is some useful information on tags at Git - Tagging however I would also suggest the commands below are useful.

Command Description
git push --tags push the tags to the origin or remote, otherwise they are local only
git show 'hello' display details of the tagged commit
git checkout 'hello' this will checkout a tag but creates a detached HEAD, so do not commit!
git checkout -b new-branch 'hello' this will checkout a new branch based on the tag

See also: