0

I have a local git repositories which initialized with

git svn init http://abc.xxx/svn/trunk/topic_A

And then I create a local branch topic_B, and want to put it under the svn URL http://abc.xxx/svn/branches/topic_B. The svn branch is created with svn client. So I don't need to create svn branch in git.

How should I modify the .git/config file to add this?

I have tried to add with:

[svn-remote "topic_B"]
url = https://abc.xxx/branches/topic_B/
fetch = :refs/remotes/topic_B

[branch "topic_B"]
remote = .
merge = refs/remotes/topic_B

However when using git from the console, git commit always choose the trunk URL as the push destination?</p>

And in sourcetree, the GUI seems to have difficulty to fetch the newly added remote svn branch.

And it seems there is noway you can change the push destination of subversion.

Any one can figure out a correct way? Thanks a lot!

4

2 回答 2

1

您可以简单地将其重命名[svn-remote "topic_B"]为不同的名称,这样就不会发生冲突。

而且似乎您无法更改颠覆的推送目的地。

另一种选择是通过命令行而不是配置文件来设置它:

git config --add svn-remote.topic_B.url ...
git config --add svn-remote.topic_B.fetch :refs/remotes/topic_B

这将生成与您的问题相同的输出。

于 2016-03-31T02:23:12.100 回答
0

好吧,我想这就是答案,但仍然不是我的完整解决方案。而且我认为已经找到了一种方法来做我实际要做的事情:

  1. 正如@CodeWizard 所说,git config svn-remote;
  2. git svn fetch topic_B;
  3. 用于git branch在当前分支上创建新分支;
  4. 将当前分支重新定位到 topic_B;
  5. git svn dcommit. 这一次它将被推送到正确的 svn URL。

这只是一个简单的想法的演示。实际问题总是比这更复杂。例如,topic_B不是创建为空目录时,作为SVN自定义,通常是通过将主干复制到branchs/topic_B目录来完成的。并且变基过程将是丰富多彩的。

我认为这可以通过读取树或樱桃采摘或通过应用补丁来解决,例如,如果只需要更改一个子目录或几个文件。但是,我对这些评论不是很熟悉,如果有人可以参考现有的解决方案,那就太好了

于 2016-04-01T01:10:28.003 回答