How do you push a tag to a remote repository using Git?

ID : 239

viewed : 123

Tags : gitgit-pushgit-taggit





Top 5 Answer for How do you push a tag to a remote repository using Git?

vote vote

96

To push a single tag:

git push origin <tag_name> 

And the following command should push all tags (not recommended):

# not recommended git push --tags 
vote vote

88

git push --follow-tags

This is a sane option introduced in Git 1.8.3:

git push --follow-tags 

It pushes both commits and only tags that are both:

  • annotated
  • reachable (an ancestor) from the pushed commits

This is sane because:

It is for those reasons that --tags should be avoided.

Git 2.4 has added the push.followTags option to turn that flag on by default which you can set with:

git config --global push.followTags true 

or by adding followTags = true to the [push] section of your ~/.gitconfig file.

vote vote

79

To push specific, one tag do following git push origin tag_name

vote vote

62

To expand on Trevor's answer, you can push a single tag or all of your tags at once.

Push a Single Tag

git push <remote> <tag> 

This is a summary of the relevant documentation that explains this (some command options omitted for brevity):

git push [[<repository> [<refspec>…]]  <refspec>... 

The format of a <refspec> parameter is…the source ref <src>, followed by a colon :, followed by the destination ref <dst>

The <dst> tells which ref on the remote side is updated with this push…If :<dst> is omitted, the same ref as <src> will be updated…

tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>.

Push All of Your Tags at Once

git push --tags <remote> # Or git push <remote> --tags 

Here is a summary of the relevant documentation (some command options omitted for brevity):

git push [--all | --mirror | --tags] [<repository> [<refspec>…]]  --tags 

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

vote vote

55

You can push all local tags by simply git push --tags command.

$ git tag                         # see tag lists $ git push origin <tag-name>      # push a single tag $ git push --tags                 # push all local tags  

Top 3 video Explaining How do you push a tag to a remote repository using Git?







Related QUESTION?