首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > CVS SVN >

创造 svn branch 和使用 git-svn

2012-07-24 
创建 svn branch 和使用 git-svn .but failed with the following informationMultiple branch paths defi

创建 svn branch 和使用 git-svn .


but failed with the following information

Multiple branch paths defined for Subversion repository.
You must specify where you want to create the branch with the --destination argument.


After googling it, I checked my .git/config file and it looks like this:

[core]
??????? repositoryformatversion = 0
??????? filemode = true
??????? bare = false
??????? logallrefupdates = true
??????? ignorecase = true
[svn-remote "svn"]
??????? url = https://svn_add/svn/project_name/trunk
??????? fetch = :refs/remotes/git-svn


The url here points to the trunk directory and we need to specify branch destination here.
There are two ways to specify destination here.
In the first way, we could change the url back to the root directory and change the fetch directory. The modified file would like this:

[svn-remote "svn"]
??????? url = https://svn_add/svn/project_name
??????? fetch = trunk: refs/remotes/git-svn
??????? branches = branches//*:refs/remotes/*

The second way is keeping the url and fetch untouched, just use relative path for the branches.

[svn-remote "svn"]
??????? url = https://svn_add/svn/project_name/trunk
??????? fetch = :refs/remotes/git-svn
??????? branches = ../branches//*:refs/remotes/*


Both way could work, and I prefer the first one, because it looks much intuitive and don't have deal with relative directory.
If u r not sure about the result, u could add -n or --dry-run to test the result of the command, like this

git svn branch -n -m "message" branch_name

After I created a branch in the svn repository, I used command

git checkout -b local_branch_name remote_branch_name

to generate a new git branch locally which point to the branch I just created in the svn repository.
Now I could stash pop my spiking code and commit them to the branches in svn repository respectively.

?

Thanks GaoLi and her baby for their help.

热点排行