问题
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 know if a tag has been pushed or not after it is created? I can see all my tags locally, but I need to be sure that they are present in remote so that other developers can pull them.
回答1:
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?")
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".
回答2:
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.
来源:https://stackoverflow.com/questions/25984310/how-to-see-remote-tags