如何供应 - prune标签以git拉?
来自 https://git-scm.com/docs/docs/git-pull/2.34 .0 :
-p
- Prune
在获取之前,请删除遥控器上不再存在的任何远程跟踪引用。如果仅由于默认标签自动遵循标签,标签被取出,则不会进行修剪 或由于- 标签
选项。但是,如果由于明确的RefSpec而获取标签(在命令行或远程配置中,例如,如果将遥控器与- Mirror
选项一起克隆),则它们也是主题的修剪。 提供- 修剪标签
是提供标签refspec的简写。
,我的git拉力给了我一个错误:
$ git --version
git version 2.34.1.windows.1
$ git pull --prune-tags
error: unknown option `prune-tags'
$ git pull --prune --prune-tags
error: unknown option `prune-tags'
$ git pull --prune --tags --prune-tags
error: unknown option `prune-tags'
甚至:
$ git pull --prune --tags origin --prune-tags
error: unknown option `prune-tags'
但是,假设> T1
是标签的名称:
$ git pull --prune --tags origin t1
From ssh://[stripped]
* tag t1 -> FETCH_HEAD
Already up to date.
From https://git-scm.com/docs/git-pull/2.34.0:
-p
--prune
Before fetching, remove any remote-tracking references that no longer exist on the remote. Tags are not subject to pruning if they are fetched only because of the default tag auto-following
or due to a--tags
option. However, if tags are fetched due to an explicit refspec (either on the command line or in the remote configuration, for example if the remote was cloned with the--mirror
option), then they are also subject to pruning. Supplying--prune-tags
is a shorthand for providing the tag refspec.
However, my git pull gives me an error:
$ git --version
git version 2.34.1.windows.1
$ git pull --prune-tags
error: unknown option `prune-tags'
$ git pull --prune --prune-tags
error: unknown option `prune-tags'
$ git pull --prune --tags --prune-tags
error: unknown option `prune-tags'
Even:
$ git pull --prune --tags origin --prune-tags
error: unknown option `prune-tags'
However, this works, assuming t1
is a name of the tag:
$ git pull --prune --tags origin t1
From ssh://[stripped]
* tag t1 -> FETCH_HEAD
Already up to date.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确实,它看起来像是通过
git lupl
处理选项的错误。使用
GIT版本2.35.0
:git Pull-prune -prune-tags Origin
产生“未知选项'Prune-tags'”,git fetch- -prune -prune-tags Origin
works> works> works(和删除标签)[update]
@torek表示,请注意,该选项未在
git git pull
options中列出。 -prune-tags 在- prune
git hers help lust lut
的部分中暗示,这与git git help的段落是相同的段落提取
。但是,对于git拉拉
也可以处理该选项是有意义的。Indeed, it looks like a bug in how options are handled by
git pull
.Testing with
git version 2.35.0
:git pull --prune --prune-tags origin
yields "unknown option 'prune-tags'"git fetch --prune --prune-tags origin
works (and deletes said tags)[update]
as @torek commented, note that the option is not listed in
git pull
options :--prune-tags
is hinted at in the--prune
section ofgit help pull
, which is the same paragraph as the one fromgit help fetch
. It would however make sense forgit pull
to handle that option as well.