git push --tags is a separate operation to git push since pushing tags should be a conscious choice to avoid accidentally pushing the wrong one. That’s fine. But how do I push them both simultaneously / atomically? (git push && git push --tags is not perfectly atomic.)
git push –tags is a separate operation to git push since pushing tags should
Share
Update August 2020
As mentioned originally in this answer by SoBeRich, and in my own answer, as of git 2.4.x
(Note: this actually work with HTTPS only with Git 2.24)
Update May 2015
As of git 2.4.1, you can do
As noted in this thread by Matt Rogers answering Wes Hurd:
--follow-tagsonly pushes annotated tags.That would be pushed (as opposed to
git tag <tagname>, a lightweight tag, which would not be pushed, as I mentioned here)Update April 2013
Since git 1.8.3 (April 22d, 2013), you no longer have to do 2 commands to push branches, and then to push tags:
You can now try, when pushing new commits:
That won’t push all the local tags though, only the one referenced by commits which are pushed with the
git push.Git 2.4.1+ (Q2 2015) will introduce the option
push.followTags: see "How to make “git push” include tags within a branch?".Original answer, September 2010
The nuclear option would be
git push --mirror, which will push all refs underrefs/.You can also push just one tag with your current branch commit:
You can combine the
--tagsoption with a refspec like:(since
--tagsmeans: All refs underrefs/tagsare pushed, in addition to refspecs explicitly listed on the command line)You also have this entry "Pushing branches and tags with a single "git push" invocation"
Beware, as commented by Aseem Kishore
push = +refs/heads/*will force-pushes all your branches.René Scheibe adds this interesting comment: