问题
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