警告:引用名称“xxx”使用 git-svn 时不明确

发布于 2024-10-10 20:52:16 字数 463 浏览 3 评论 0原文

我使用 git 作为 Subversion 的前端(通过 git svn)。

因此,对于每个 svn trunk/branch,我在 git 中都有一个名为“remotes/xxx”的远程分支。例如“遥控器/主干”、“遥控器/coolfeature”。

现在我希望每个远程分支都有一个“默认”本地分支,以将其用于 dcommit。问题是我希望这些分支以 Subversion 分支命名,比如“trunk”、“coolfeature”,所以我在 git 中有以下分支:

trunk
coolfeature
remotes/trunk
remotes/coolfeature

问题是每次我引用“trunk”或“coolfeature”时 git 都会抱怨分支名称不明确。没什么大不了的,但是我感觉不舒服。

问题是,假设简单地重命名分支不是我想要做的,我该如何处理该警告。对于此类情况,最佳做法是什么?

I am using git as a frontend to Subversion (via git svn).

So, for every svn trunk/branch I have remote branch in git named "remotes/xxx". For example "remotes/trunk", "remotes/coolfeature".

Now I want have one "default" local branch for every remote branch, to use it for dcommit. The problem is that I want such branches to be named after Subversion branches, like "trunk", "coolfeature", so I have the following branches in git:

trunk
coolfeature
remotes/trunk
remotes/coolfeature

The problem is that every time I reference "trunk" or "coolfeature" git complains branch name is ambiguous. Not a big deal, but I feel uncomfortable.

The question is, how can I deal with that warning, assuming that simply renaming branches is not what I want to do. What are the best practices for such cases?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

凉城凉梦凉人心 2024-10-17 20:52:16

如果将 --prefix=svn/ 标志传递给 git svn clone 命令,则所有 Subversion 分支都将命名为 remotes/svn/branchname。如果您可以接受,它会修复“引用名称不明确”警告。它还为您提供了一种引用远程 svn 分支的好方法,例如,如果您想创建本地跟踪分支,则类似于:

$ git checkout -bbranchname svn/branchname

然后,本地分支与远程 svn 分支具有相同的名称,并且不存在模糊的引用名称问题。

If you pass the --prefix=svn/ flag to the git svn clone command, then all of the Subversion branches would be named like remotes/svn/branchname. If this is acceptable to you, it fixes the "refname is ambiguous" warning. It also gives you a nice way of referring to the remote svn branches, as in for instance if you want to create a local tracking branch it would be something like:

$ git checkout -b branchname svn/branchname

The local branch then has the same name as the remote svn branch, and no ambiguous refname problem.

岛徒 2024-10-17 20:52:16

如果您只是想摆脱警告,请将 core.warnAmbigouslyRefs 设置为 false:

git config --global core.warnambiguousrefs false

如果您希望此行为仅适用于单个存储库,请省略 --global代码> 标志。

If you just want to get rid of warning, set core.warnAmbiguousRefs to false:

git config --global core.warnambiguousrefs false

If you want this behavior only for single repository, omit --global flag.

鱼忆七猫命九 2024-10-17 20:52:16

您可能有另一个“trunk”和“coolfeature”作为标签。在这种情况下,git 不知道您引用的是分支还是标签。重命名标签并检查 git 是否未报告“不明确”名称

It can be possible that you have another 'trunk' and 'coolfeature' as a tag. In this case, git doesn't know if you refer to branch or tag. Rename the tags and check if git doesn't report "ambiguous" name

初心未许 2024-10-17 20:52:16

为了避免冲突消息,当引用本地分支时,请在它们前面添加 heads/ 前缀,

例如,冲突分支 topic

$ git diff topic remotes/topic
warning: reframe 'topic' is ambiguous.
...

变为

$ git diff heads/topic remotes/topic
...

To avoid the conflict messages, when referring to local branches, prefix them with heads/

for example, the conflicting branch topic

$ git diff topic remotes/topic
warning: reframe 'topic' is ambiguous.
...

becomes

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