git pull - will it fetch tags on remote by default?

偶尔善良 提交于 2019-12-10 11:26:36

问题


I know git fetch --tags will fetch all tags from remote to local.

I am not sure will git pull get tags from remote by default, so will it or not?


回答1:


It should, since git pull does a git fetch and a git merge.

But it will do so only from git 1.9.0+, as I mentioned in "Does “git fetch --tags” include “git fetch”?".




回答2:


A git pull will by default only fetch tags that are reachable by the objects that are fetched.

From the git pull documentation

--no-tags

By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following. The default behavior for a remote may be specified with the remote.<name>.tagopt setting. See git-config[1].

So you should also take a look at the tagopt config to see what git does for your repository.

remote.<name>.tagopt

Setting this value to --no-tags disables automatic tag following when fetching from remote . Setting it to --tags will fetch every tag from remote , even if they are not reachable from remote branch heads. Passing these flags directly to git-fetch1 can override this setting. See options --tags and --no-tags of git-fetch1.



来源:https://stackoverflow.com/questions/27716846/git-pull-will-it-fetch-tags-on-remote-by-default

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