如何供应 - prune标签以git拉?

发布于 2025-02-09 18:43:32 字数 1079 浏览 1 评论 0原文

来自 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悟红尘 2025-02-16 18:43:32

确实,它看起来像是通过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'"
  • but 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 of git help pull, which is the same paragraph as the one from git help fetch. It would however make sense for git pull to handle that option as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文