从git自动更新svn

时间:2012-07-25 03:57:11

标签: git-svn

这就是我想做的事情。是否可能

  • 在git中有项目。很多人推,拉,合并等。正常的工作流程
  • 只有其中一个git repo的推送更改为它的主分支到svn。

没有人会致力于svn回购。这只是一个方向。从git到svn。它只会在git上对master进行更改并将它们添加到svn中。 svn基本上是主分支的svn版本。

我以为我可以做到

git svn dcommit

一遍又一遍地

..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit
..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit
..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit

但这似乎不起作用。我不断收到像

这样的冲突和消息
$ git svn dcommit
Committing to https://my.svn.repo/svn/ ...
        M       README.md
Committed r18619
        M       README.md
r18619 = 8f00073a3f1987e97a0f0f194798b6e02e9b0345 (refs/remotes/git-svn)
No changes between current HEAD and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn
Unstaged changes after reset:
M       README.md
        M       README.md
Committed r18620
        M       README.md
r18620 = 47313477c1e38959fadd43d0001ff55210637669 (refs/remotes/git-svn)
No changes between current HEAD and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

这看起来很可疑。 git status给了我

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 2 different commits each, respectively.
#

我觉得我从根本上错过了一些东西。也许我根本不应该使用git-svn。事实上,如果我所做的只是这个

cd ~/git-folder
..edit files..
git commit -a -m "foo"
cd ~/svn-folder
cp -r ~/git-folder .
svn commit -m "foo"

它实际上会工作,我只会丢失所有提交消息和个人提交。

有人可以指出我缺少的东西

2 个答案:

答案 0 :(得分:2)

一切都好。 'origin / master'与使用refs / remotes / git-svn反映SVN状态的git-svn之间没有关系。 'master'和'origin / master'分歧是因为git-svn没有触及'origin / master'但是用'(通常)相同内容但使用“git-svn-id”签名的提交替换'master'中的提交提交消息(所以sha-1哈希以这种方式改变)。

答案 1 :(得分:0)

git svn dcommit的输出对我来说很好,它只是在SVN存储库中重新创建Git提交。如果您svn co SVN存储库,您将看到相同的提交。

我怀疑你已经从其他地方克隆了Git存储库,或者已经推送了存储库,正如你有一个origin/master分支所表明的那样; git-svn分支不会添加到origin遥控器下。

换句话说,我在这里看不到任何引起警报的事情。一切似乎都按预期工作。