Git:警告:使用git-svn时,refname'xxx'是不明确的 [英] Git: warning: refname 'xxx' is ambiguous when using git-svn

查看:332
本文介绍了Git:警告:使用git-svn时,refname'xxx'是不明确的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



因此,对于每个svn trunk /分支,我都有一个远程分支在git中命名为remotes / XXX。例如遥控器/主干,遥控器/酷炫功能。

现在我希望每个远程分支都有一个默认本地分支,用于dcommit。问题是我想要这样的分支以Subversion分支命名,例如trunk,coolfeature,所以我在git中有以下分支:

 后备箱
炫酷
遥控器/后备箱
遥控器/炫酷

问题是,每次我引用trunk或coolfeaturegit抱怨分支名称是不明确的。没什么大不了的,但我感到不舒服。



问题是,我该如何处理这个警告,假设简单地重命名分支不是我想要做的。什么是这种情况下的最佳实践?

如果您传递 - prefix = svn / 标志到 git svn clone 命令,那么所有的Subversion分支将被命名为 remotes / svn / branchname 。如果这是你可以接受的,它修复了refname不明确的警告。它还为您提供了一个很好的方式来引用远程svn分支,例如,如果您想创建一个本地跟踪分支,它将是这样的:



$ git checkout -b branchname svn / branchname



本地分支的名称与远程svn分支相同,并没有歧义的refname问题。


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?

解决方案

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.

这篇关于Git:警告:使用git-svn时,refname'xxx'是不明确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆