19

The default behavior of Git is not to push tags from a local repository to an associated remote one. In this answer it is explained how to change this behavior for a single repository.

My question, is why is this the designed behavior of Git? In particular what are the cons of setting on automatic push of tags?

Community
  • 1
  • 1
Dror
  • 12,174
  • 21
  • 90
  • 160
  • 1
    `tag` is a **snapshot** of the repository. My guess is that it shouldn't be updated upon push, unless, you explicitly would like it to be published. – yuwang May 30 '13 at 06:45
  • see also http://stackoverflow.com/a/2988182/654952 – yuwang May 30 '13 at 06:56
  • 1
    @yuwang: I already linked to this answer. There is a comment there posing the same question which is still unanswered... – Dror May 30 '13 at 07:09
  • it's **well described** IMO, see the quoted: "This is very much intended behaviour, to make pushing tags explicit. Pushing tags should be usually conscious choice." – yuwang May 30 '13 at 07:11
  • I didn't see the answer you provided before I made first comment. anyway I think the link you provided **already** answered your question. – yuwang May 30 '13 at 07:13
  • 1
    @yuwang: Not really. "should be usually..." is sort of general. What can go wrong if you *do* push *all* tags... – Dror May 30 '13 at 07:32
  • @Dror ending with hundreds of tags in the upstream repo, most of them having no interest. As described in my answer below. – VonC May 30 '13 at 08:02
  • I don't get it. What are these hundreds of tags that people would be creating locally that have no meaning upstream? – O'Rooney Sep 07 '22 at 00:05

1 Answers1

9

If you consider the tags of any large project (kernel linux, git itself, ...) you would see tags in the hundreds.

A Distributed VCS is all about publication: what do you want to push?
Everything? All the time?

Pushing all tags can pollute the tags space from the upstream repo.

With the current behavior, you keep the control of what you are publishing to the upstream repo, for others to see.


Note that since git 1.8.3 (April 2013), the git push --follow-tags can help you push commits and their associated tags in one command.

See "Push git commits & tags simultaneously".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250