我们可以设置Git默认值以在远程请求期间获取所有标签吗? [英] Can we set a Git default to fetch all tags during a remote pull?
问题描述
我目前有一个git远程设置,如下所示:
I currently have a git remote setup like the following:
[remote "upstream"]
url = <redacted>
fetch = +refs/heads/*:refs/remotes/upstream/*
当我在分支主服务器上发布git pull
时,所有远程头都被提取到远程服务器/上游服务器中,然后将远程服务器/上游/主机合并到主服务器中.可以同时获取所有可以到达的标签,这非常方便.
When I issue git pull
on branch master, all remote heads are fetched into remotes/upstream, then remotes/upstream/master is merged into master. Any tags that can be reached are also fetched at the same time, which is very convenient.
我希望git pull
另外从远程获取 all 标签,而不仅仅是从头部直接可以访问的标签.我最初尝试设置tagopt == --tags
,但是发现这只会导致标签被读取,从而破坏了所有内容. (朱尼奥甚至说,这是严重的配置错误).
I'd like git pull
to additionally fetch all tags from the remote, not just those that are directly reachable from the heads. I originally tried seting tagopt == --tags
, but found this caused only tags to be fetch and thus broke everything. (Junio even says that's a horrendous misconfiguation).
除了远程头以外,是否有一种方法可以使git pull
默认情况下获取所有远程标签?
Is there a way to make git pull
fetch all remote tags by default, in addition to the remote heads?
推荐答案
您应该可以通过将标记的refspec添加到本地配置中来完成此操作.具体来说:
You should be able to accomplish this by adding a refspec for tags to your local config. Concretely:
[remote "upstream"]
url = <redacted>
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/tags/*:refs/tags/*
这篇关于我们可以设置Git默认值以在远程请求期间获取所有标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!