Create a tag in Git

Creating tags from the command line

To create a tag on your current branch, run the following commands in your terminal:

git tag <tagname>

Add -a to generate an Β annotated tag if you want to include a description with your tag::

git tag <tagname> -a

This will generate a local tag containing the current state of the branch you’re working on. Tags are not supplied by default when pushing to your remote repo. You must expressly request that your tags be pushed to your remote repository:

git push origin --tags
--tags

All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

Or if you just want to push a single tag:

git push origin <tag>
List Tags

To list all tags you can run following

git tag


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *