tags:

views:

28

answers:

1

I have an SVN branch with several commits that I want to export and merge into a git repository based on the same code (but without the changes). How do I do that?

I have tried creating a new git repo using git svn and then merging to git repos together, but that marked every single line in conflicting files as a conflict. Can I force it to run a proper diff instead of just marking everything as a conflict?

Update. I ended up creating a branch and copy-pasting files from svn there, then did a merge with another branch. Nasty, but it worked.

+1  A: 

You're going to need to read a lot of documentation, but I can try to point you in the right direction. At least, I hope it's the right direction...

After creating the git repository using git svn, you can use git fetch to bring the svn changes into the git repository as its own branch. Then, you can use git filter-branch --parent-filter to set the appropriate svn commit's parent to the appropriate git commit. Then, you can use git rebase to clean up the commits, if necessary.

Joseph Spiros
Why can't it just run diff on all files and find the changes? Or can I just create patch files and apply them one by one?
HeavyWave
Well, by doing what I've described, it does run a diff, as it needs to know which parent commit to diff against. Creating patch files and applying them should work, but I think git patches contain metadata as to which git commit they're based upon. If that's the case, you'll want to make sure you set the parent commit of the first patch appropriately.
Joseph Spiros