Git - working with tags
Table of Contents
Fetch tags
First, make sure that the tag exists locally by doing
git fetch --all --tags --prune
or
git rup
See the list of all tags
git tag
git tag --list 'v-*'
Checkout tags
Then check out the tag by running
git checkout tags/<tag_name>
or
git checkout tags/<tag_name> -b <branch_name>
If the tags don’t have the word tags
in them, don’t use them in the command. Use the list command from above to see the list of available tags.
git checkout 1.0.tag_version
Instead of origin/
use the tags/
prefix.
Create tags
How to create tags? There are 2 ways to create a tag:
git tag v1.0
git tag -a v1.0
Delete tags
Delete a local tag
git tag -d <tag_name>
Deleted tag <tag_name> (was 000000)
Note: If you try to delete a non existig Git tag, there will be see the following error:
$ git tag -d <tag_name>
error: tag '<tag_name>' not found.
Delete remote tags
git push --delete origin <tag name>
Push tags
git push --tags
To push all tags:
git push --tags