tags:

views:

482

answers:

1

I have recently decided to take the git plunge, and am really enjoying using git, even on Windows.

My current open source project lives on subversion, all devs are familiar with subversion so I would like to keep subversion as the "source of truth" for now.

Nonetheless, I want to use git, so I went ahead and created a copy of the source on github using git svn. All my work is done against the source in github and I push my changes to github. Once every few days I also push my changes to svn and rebase.

The initial import seemed to go ok, but now every time I do a "git svn rebase" I keep on getting conflicts, even on files I have not changed in my get repository. This is causing me 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

My questions:

  1. Is there any way I can tell git to sync itself up with svn using svn as the source, so I can start with a clean slate. (export latest, check in changes and reset the svn refs somewhere)

  2. Are there any tips and tricks to getting this scenario to work consistently?

  3. Should I have the core.safecrlf and core.autocrlf options set to true? It seems I will need a bit of hoop jumping.

Related:

It seems getting line endings right is a bit of a black art.

(I realize that this question probably needs to be expanded, please comment on the places that need expanding)

+1  A: 
1800 INFORMATION
sometimes ... the line ending ones less annoying, it seems to say something along the lines of "squelching xxx line ending conflict" the ones that get me are the non-line ending conflicts. it says a whole file is in conflict state when I never touched it ...
Sam Saffron
Sounds like you are getting line ending conflicts - if the whole file is inconflict this is probably because something changed all the line endings
1800 INFORMATION
Whats the best practice when it comes to line-endings, git, svn and interoperability on windows?
Sam Saffron
well I started getting the problems with core.autocrlf = false , but the problem persist with the repo being true, it seems i manage to mess stuff up to a pretty bad state ... I may need to run a script to clean this mess up
Sam Saffron
You might now have some files in the repository with line endings that you don't want - so changing autocrlf might now mean that git will think they have changed. You should be able to fix those up by checking them back in, I guess
1800 INFORMATION