如何在Git-Svn存储库中更改前缀映射? [英] How can I change the Prefix Mapping in a Git-Svn Repository?

查看:137
本文介绍了如何在Git-Svn存储库中更改前缀映射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用git-svn创建了SVN存储库的Git克隆.这样做时,我指定了--prefix选项为我的远程分支添加前缀.我现在想摆脱这个前缀.

I've created a Git Clone of a SVN repository using git-svn. When doing this I specified the --prefix option to prefix my remote branches. I now want to get rid of this prefix.

是否可以在不重新克隆存储库的情况下更新或删除前缀?

Is there a way to update or remove the prefix without re-cloning the repository?

基本上,我使用--prefix=Project进行了初始克隆,因此最终以Project/trunkProject/feature-branch作为远程跟踪分支.我想要的只是将trunk称为trunk,将feature-branch称为svn/feature-branch.

Essentially I did the initial clone using --prefix=Project so I ended up with Project/trunk and Project/feature-branch as my remote tracking branches. What I want is to have the trunk just be called trunk and the feature-branch be called svn/feature-branch.

推荐答案

注意:当前解决方案可能不再适用于git 2.0+(2014年4月)

Note: the current solution might not work anymore with git 2.0+ (April 2014)

请参见 commit fe191fc /jherland"rel =" nofollow>约翰·赫兰德(jherland ),突出显示了您现在应该具有前缀(而不是 not 有一个svn分支没有前缀,例如'trunk'):

See commit fe191fc by Johan Herland (jherland), which highlight the fact you now are supposed to have a prefix (and not have a svn branch without prefix like 'trunk'):

默认情况下,没有前缀是有问题的:

Having no prefix by default was problematic:

git-svn默认情况下将其Subversion-tracking引用直接放在refs/remotes/*中.
这与Git使用 refs/remotes/$remote/* 存储远程跟踪分支的惯例背道而驰.

git-svn by default puts its Subversion-tracking refs directly in refs/remotes/*.
This runs counter to Git's convention of using refs/remotes/$remote/* for storing remote-tracking branches.

此外,将git-svn与常规git远程控件结合使用,可能会在refs/remotes下破坏refs的风险(例如,如果您的git remote名为"tags"和"v1"分支,它将重叠)带有git-svn的跟踪分支,用于Subversion中的"v1"标签.

Furthermore, combining git-svn with regular git remotes run the risk of clobbering refs under refs/remotes (e.g. if you have a git remote called "tags" with a "v1" branch, it will overlap with the git-svn's tracking branch for the "v1" tag from Subversion.

这篇关于如何在Git-Svn存储库中更改前缀映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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