git subtree fetch - unwanted remote tags

孤者浪人 提交于 2020-01-06 04:30:06

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!