问题
I am getting started with git subtree.
When fetching from a subtree remote, one thing I notice is that after a git fetch, I have all the tags from this remote. These tags could be something like v1.0.5
, and it is impossible to distinguish tags from different remotes.
This behavior is technically not surprising. But it is still undesirable.
One solution could be to omit the tags with git fetch -n
.
I wonder if this is the recommended way to do things, or if there is something smarter that people do. The -n
option is not mentioned in the tutorials I read so far.
Note: I am using git subtree as described here, the "manual" approach.
Note: An answer that simply confirms the git fetch -n
can be perfectly valid and acceptable - ideally with a link or two.
回答1:
I have the following 3 lines to work with subtree
git remote add <alias> <url>
git config --local --add remote.<alias>.fetch +refs/tags/*:refs/tags/<alias>/*
git config remote.<alias>.tagopt --no-tags
Everytime you call git fetch <alias>
the tag information of that remote is stored in a subfolder.
The command git ls-remote --tags <alias>
eventually lists these tags.
来源:https://stackoverflow.com/questions/34994409/git-subtree-fetch-unwanted-remote-tags