git tag -l
or, if you want to print tag with the messages
git tag -n
Let say we want to name the tag as v1.2.3
, for latest commit we can assign it to HEAD
git tag -a v1.2.3 HEAD -m "Release 1.2.3"
But if we want to tag the specific commit, just put commit hash after tag annotation, for example the commit hash is 240743d
git tag -a v1.2.3 240743d -m "Release 1.2.3"
The -m
options means message.
Tag that we create on local will not created on remote yet, so we need to push it
git push --tags
If you find any misleading information or grammar issue, feel free to make corrections here.