双向Git Svn Sync(可写)是否可能? [英] Is a bidrectional Git<->Svn Sync (both writable) possible?

查看:398
本文介绍了双向Git Svn Sync(可写)是否可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们团队的一部分人发现git很酷,并开始使用它作为svn客户端。所以每个开发者都有一个本地的git仓库,并通过git-svn与svn同步。

然后,我们想对提交进行代码审查,并将补丁发送给同事进行审查。这种方法不是很直观,因为svn中的 SAME 修订版的校验和对于每个本地git存储库都是不同的。不知道为什么,因为内容应该是相同的。可能它是 svn rebase



中的一个错误所以我们试图在scm服务器上拥有一个中央git存储库。现在每个使用git的开发人员都可以将他的更改推送到这个中央存储库,而执行审查的其他开发人员可以将这些更改拖到他的回购站中。不幸的是,因为每个开发者都与 svn rebase 同步了校验和问题。



使用subversion和git客户端来管理团队的最佳方式是:有一个中央Subversion存储库
$ b


  1. b
  2. 中央Git存储库(origin)

  3. 服务器上的中央Git工作副本 / li>
  4. 对于每个svn开发者来说,一个普通的工作副本

现在我们需要一个中央工作来同步svn使用git在服务器上的中心git工作副本上执行这样的常规脚本。

 #首先将提交从git传输到svn 
git checkout svnmaster
git pull origin svnmaster
git svn dcommit

#现在从svn到git
git svn rebase
git push原产地svnmaster

现在我的问题是:


  1. 这是最好的方法(无需切换到git completeley)
  2. 是否已有用于执行同步防弹的Windows脚本?

  3. 是否有不同校验和已知的问题,可能有
    a解决方法?

感谢您的每一个回答!



编辑
我最近发现一个看起来非常有前途的项目:



SubGit

解决方案

您的解决方案存在问题。我建议你不要直接在svnmaster中提交。你应该为svn(svn-dev)和svn跟踪分支(svn-master)建立一个纯粹的git分支。按照以下步骤提交到svn:

  git checkout svn-master 
git merge --no-ff svn- dev
git svn dcommit
git checkout svn-dev
git merge svn-master

该序列允许您为所有存储库保留提交哈希。


a part of our team found out that git is cool and started using it as a svn client. So every developer had a local git repository and synced it with svn via git-svn.

Then we wanted to do code reviews of the commits and send patches to collegues for review. This approach was not very intuitive, since the checksums of the SAME Revision in svn was different for each local git repository. No clue why, since the content should be the same. Maybe it is a bug in svn rebase?

So we tried to have a central git repository on the scm server. Every developer that uses git now could push his changes to this central repository and the other developer doing the review could pull those into his repo. Unfortunatelly because every developer also synced with svn rebase the checksum problem was there again.

After reading many posts I think the best way to manage a team with both subversion and git clients is to have:

  1. A central Subversion repository
  2. A central Git repository (origin)
  3. A central Git working copy on the server
  4. For each git developer a local git repository
  5. For each svn developer a ordinary working copy

Now we need a central job to sync svn with git doing a regular script like this on a central git working copy on the server.

# First transfer the commits from git to svn
git checkout svnmaster
git pull origin svnmaster
git svn dcommit

# Now from svn to git
git svn rebase
git push origin svnmaster

My questions now are:

  1. Is this the best approach (without switching to git completeley)
  2. Are there already scripts for windows doing the sync bullet proof?
  3. Is the problem with the different checksums known and is there maybe a workaround known?

Thanks for every answer!

EDIT I recently found a project that looks very promising:

SubGit

解决方案

There is problem with your solution. I recommend you not to commit in svnmaster directly. You should have one pure git branch for svn(svn-dev), and svn tracking branch(svn-master). Follow these steps to commit to svn:

git checkout svn-master
git merge --no-ff svn-dev
git svn dcommit
git checkout svn-dev
git merge svn-master

This sequence allows you to preserve commit hashes for all repositories.

这篇关于双向Git Svn Sync(可写)是否可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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