How to make “git push” include tags within a branch?

前端 未结 1 1992
误落风尘
误落风尘 2020-12-09 07:25

When fetching a single branch, git fetch includes any tags that point into the branch:

When refspec stores the fetched result in remote-t

相关标签:
1条回答
  • 2020-12-09 08:12

    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.

    0 讨论(0)
提交回复
热议问题