Home

Push a tag to git repo using CLI

Adding a tag

To add a tag to a git repository, run the following command:

git tag <tagname>

Adding a tag with a message attached to it

If you want to add a message to the tag

git tag -a <tagname> -m '<message>'

I suggest you to add a message for every tag. Because git push --follow-tags will push the tags that have annotations only.

Push tags to github repo

To push a single tag to a git repo, run the following command:

git push origin <tag_name>

To push all tags to a git repo, run the following command:

git push --follow-tags

It pushes both

It doesn't push

Use the command git config --global push.followTags true to turn on this flag by default.

Another way to push all tags to remote repo is to run git push --tags. This is not recommended because it pushes all tags including lightweight tags that are not annotated and tags on unrelated branches.



Last Updated on

Next Post: Rules vs Guidelines →

Comments