How to see remote tags?

后端 未结 2 1672
北恋
北恋 2020-12-22 18:47

In Atlassian SourceTree, how to know which tags are only local and which are also in remote?

When creating a tag you get the option \"Push tag to: ...\", but how to

相关标签:
2条回答
  • 2020-12-22 19:21

    You can list the tags on remote repository with ls-remote, and then check if it's there. Supposing the remote reference name is origin in the following.

    git ls-remote --tags origin
    

    And you can list tags local with tag.

    git tag
    

    You can compare the results manually or in script.

    0 讨论(0)
  • 2020-12-22 19:26

    Even without cloning or fetching, you can check the list of tags on the upstream repo with git ls-remote:

    git ls-remote --tags /url/to/upstream/repo
    

    (as illustrated in "When listing git-ls-remote why there's “^{}” after the tag name?")

    xbmono illustrates in the comments that quotes are needed:

    git ls-remote --tags /some/url/to/repo "refs/tags/MyTag^{}"
    

    Note that you can always push your commits and tags in one command with (git 1.8.3+, April 2013):

    git push --follow-tags
    

    See Push git commits & tags simultaneously.


    Regarding Atlassian SourceTree specifically:

    Note that, from this thread, SourceTree ONLY shows local tags.

    There is an RFE (Request for Enhancement) logged in SRCTREEWIN-4015 since Dec. 2015.

    A simple workaround:

    see a list of only unpushed tags?

    git push --tags

    or check the "Push all tags" box on the "Push" dialog box, all tags will be pushed to your remote.

    That way, you will be "sure that they are present in remote so that other developers can pull them".

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