When fetching a single branch, git fetch
includes any tags that point into the branch:
When refspec stores the fetched result in remote-tracking branches, the tags that point at these branches are automatically followed. This is done by first fetching from the remote using the given s, and if the repository has objects that are pointed by remote tags that it does not yet have, then fetch those missing tags. If the other end has tags that point at branches you are not interested in, you will not get them.
Is there any way to make git push
behave the same way? The man page says how to push no tags (the default), all tags (--tags
), or ones you name on the command line. It doesn't give a way to push all the ones pointing into the branch.
git push <remote> --tags will push both lightweight and annotated tags. There is currently no option to push only lightweight tags, but if you use git push <remote> --follow-tags only annotated tags will be pushed to the remote.
Push all git tags to remote And if you want to push all tags from your local to the remote then add "--tags" to the git command and it will push all tags to the remote.
Right click on the commit you want to tag, and click Create Tag at this version... Back to Log Message dialog, right click on that tag label, click Push "tag_name"...
You can try, with git1.8.3+ (May 2013):
git push --follow-tags
The new "
--follow-tags
" option tells "git push
" to push relevant annotated tags when pushing branches out.
This won't push all the tags, but only the ones accessible from the branch(es) HEAD(s) you are pushing.
As mentioned in "Push a tag to a remote repository using Git?", this concerns only annotated tags, not lightweight tags.
git tag 1.0
(lightweight) would not be pushed with --follow-tags
, it would with git push --tags
.
With Git 2.4.1+ (Q2 2015), that option can be set as default.
See commit a8bc269 by Dave Olszewski (cxreg
):
make it easier to add new configuration bits and then add
push.followTags
configuration that turns--follow-tags
option on by default.
The documentation will include:
push.followTags::
If set to true enable '
--follow-tags
' option by default. You may override this configuration at time of push by specifying '--no-follow-tags
'
Do enable this setting globally, you can run git config --global push.followTags true
. It can also be specified on a per repository-basis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With