简体   繁体   English

带有同步SVN备份的Git

[英]Git with synchronized SVN backup

I've been working for some time with SVN and I'm now in the process of migrating to GIT, for rather obvious reasons. 我已经在SVN上工作了一段时间,出于相当明显的原因,我现在正在迁移到GIT。 I can already create the git repository out of the svn one. 我已经可以使用svn创建一个git存储库。

As I'm not very confident with GIT, before to effectively choose it as my versioning system, I want to keep the SVN repository synchronized with the GIT one, while working with GIT. 由于我对GIT不太自信,因此在有效选择它作为我的版本控制系统之前,我希望在使用GIT时保持SVN存储库与GIT保持同步。

I'm quite able to do this, through post push hooks, but I have the following issues: 我可以通过后推钩做到这一点,但是我遇到以下问题:

1) The svn commit is done by the same user (the one that controls the GIT repository from which the dcommits are performed). 1)svn提交由同一用户(控制从中执行dcommit的GIT存储库的用户)完成。

2) In order for git svn to evaluate the new differences to commit on the SVN, it changes the GIT commit metadata by adding an ugly "git-svn-id". 2)为了使git svn评估要提交到SVN上的新差异,它通过添加难看的“ git-svn-id”来更改GIT提交元数据。 This alters the commit-sha and therefore requires an additional git pull which moreover creates a "diamond" in the repository tree. 这会改变提交方式,因此需要额外的git pull,而且还会在存储库树中创建“钻石”。

Is there a way to avoid this? 有办法避免这种情况吗?

Note that I could be satisfied by just ensuring a one side synchronization (from GIT to SVN), whereas the opposite does not have to hold. 请注意,只要确保单边同步(从GIT到SVN),我就会感到满意,而不必保持相反。

Thanks in advance. 提前致谢。

1) You can configure your local GIT repository to map back and forth between SVN users and GIT authors by creating an authors text file with the format: 1)您可以通过创建以下格式的作者文本文件来配置本地GIT存储库,以在SVN用户和GIT作者之间来回映射:

svnjohndoe = John Doe <john.doe@acme.com>

You'll have to tell git svn clone to use it by specifying the --authors-file option: 您必须通过指定--authors-file选项来告诉git svn clone使用它:

$ git svn clone http://someproject/svn --authors-file=authors.txt

2) You can avoid the git-svn-id in your commits up front by cloning the SVN repository with the --no-metadata option: 2)您可以使用--no-metadata选项克隆SVN存储库,从而避免在提交就使用git-svn-id

$ git svn clone http://someproject/svn --no-metadata

Unfortunately, there's no way to avoid the git-svn-id when pushing back to SVN . 不幸的是,当推回SVN时,无法避免git-svn-id

However, a workaround to avoid having the commits SHAs changed is to push first to SVN (through git svn dcommit ) and then push to your upstream GIT repo. 但是,一种避免更改提交SHA的解决方法是先推送到SVN(通过git svn dcommit ), 然后再推送到上游GIT存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM