警告:引用名称“xxx”使用 git-svn 时不明确
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果将
--prefix=svn/
标志传递给git svn clone
命令,则所有 Subversion 分支都将命名为remotes/svn/branchname
。如果您可以接受,它会修复“引用名称不明确”警告。它还为您提供了一种引用远程 svn 分支的好方法,例如,如果您想创建本地跟踪分支,则类似于:$ git checkout -bbranchname svn/branchname
然后,本地分支与远程 svn 分支具有相同的名称,并且不存在模糊的引用名称问题。
If you pass the
--prefix=svn/
flag to thegit svn clone
command, then all of the Subversion branches would be named likeremotes/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.
如果您只是想摆脱警告,请将 core.warnAmbigouslyRefs 设置为 false:
如果您希望此行为仅适用于单个存储库,请省略
--global
代码> 标志。If you just want to get rid of warning, set
core.warnAmbiguousRefs
tofalse
:If you want this behavior only for single repository, omit
--global
flag.您可能有另一个“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
为了避免冲突消息,当引用本地分支时,请在它们前面添加
heads/
前缀,例如,冲突分支
topic
变为
To avoid the conflict messages, when referring to local branches, prefix them with
heads/
for example, the conflicting branch
topic
becomes