git和subversion可以一起玩吗?

时间:2009-06-10 00:42:45

标签: windows svn git

我最近决定采取git暴跌,我非常喜欢使用git,即使在Windows上也是如此。

我目前的开源项目lives on subversion,所有开发人员都熟悉颠覆,所以我想将颠覆作为现在的“真相来源”。

尽管如此,我想使用git,所以我继续使用on github创建了源git svn的副本。我的所有工作都是针对github中的源代码完成的,我将更改推送到github。每隔几天我也会将我的更改推送到svn和rebase。

初始导入似乎没问题,但现在每次我执行“git svn rebase”时,我都会继续发生冲突,即使是在我的get存储库中没有更改过的文件。这导致我much pain

EG。

$ git svn rebase
First, rewinding head to replay your work on top of it...
Applying: Added git ignore file
c:/Users/sam/Desktop/MediaBrowserGit/trunk/.git/rebase-apply/patch:12: trailing
whitespace.
*/obj/*
error: .gitignore: already exists in index
Using index info to reconstruct a base tree...
:12: trailing whitespace.
*/obj/*
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Failed to merge in the changes.
Patch failed at 0001 Added git ignore file

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/git-svn: command returned error: 1

我的问题:

  1. 有什么方法可以告诉git使用svn作为源同步svn,所以我可以从一个干净的平板开始。 (导出最新,签入更改并重置svn refs)

  2. 是否有任何提示和技巧可以使此方案始终如一地运作?

  3. 我应该将core.safecrlf and core.autocrlf选项设置为true吗?看来我需要一点箍跳。

  4. 相关:

    看起来正确的行结尾是一种黑色艺术。

    (我意识到这个问题可能需要扩展,请评论需要扩展的地方)

1 个答案:

答案 0 :(得分:1)

你是否遇到了行结束冲突? Git有一些配置属性,你可以设置它们来改变它处理行尾字符的方式。我有以下几套:

# this makes git NOT attempt to convert line endings on commit and checkout
core.autocrlf=false

# this makes git check if the conversion done by autocrlf would be reversible
# this is probably not required because I do not have autocrlf turned on
core.safecrlf=true

请注意,我在Windows上,我的所有同事都在Windows上,我通过git-svn与SVN连接。这些设置似乎对我有用。

alt text
(来源:codinghorror.com