Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git svn rebase is failing with a conflict to a file that does not exist in git

Tags:

git

svn

I am currently working on a project on git-hub but our development team is using subversion. I have been doing the following to keep git-hub synced with our svn repository:

git svn rebase
git pull origin master
git push origin master

This has been working fine, but somehow I have messed something up and now I have a problem with one file when I do the rebase:

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ git svn rebase
First, rewinding head to replay your work on top of it...
Applying: minor fix to table class
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: remove README, will re-add via svn
Applying: trying to fix readme
Applying: adding README file
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging README
CONFLICT (add/add): Merge conflict in README
Failed to merge in the changes.
Patch failed at 0020 adding README 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/trunk: command returned error: 1

I must have deleted and re-added the file in git and/or svn and now I have this problem. The strange thing is that the README file does not appear in my current git master. I tried deleting it from my svn trunk but this makes no difference. I have resolved the conflict and re-added the file, etc. to no avail. I even deleted my local git and started over. Something must be corrupted.

I also tried git rebase --skip, but that gives me:

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ git rebase --skip
HEAD is now at c4da146 trying to fix readme
Applying: remove README, will re-add via svn
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
CONFLICT (delete/modify): README deleted in remove README, will re-add via svn and modified in HEAD. Version HEAD of README left in tree.
Failed to merge in the changes.
Patch failed at 0021 remove README, will re-add via svn

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".

Craig-Nakamotos-MacBook-Pro:cl4 cnakamoto$ 

Does anyone know how I can fix this? It is driving me crazy. I don't need the README file at all, so I don't care if I just have to blow it away and recreate it. Thanks!

like image 393
Craig Nakamoto Avatar asked Oct 04 '10 12:10

Craig Nakamoto


1 Answers

Did you try git rebase --skip? Maintaining a separate git repo is going to be trouble prone. git dcommit rewrites your local git commits (i.e., changes the SHA-1 checksums). So, in your normal workflow:

  • change code
  • commit to github
  • change code
  • commit to github
  • git svn rebase
  • git pull origin master
  • git push origin master
  • git svn dcommit

The git pull does two things, a git fetch followed by a git merge. The merge can be trouble. Also, in that last dcommit, the local git commits were changed and no longer match what was pushed to github in the previous command.

You can read up on git-svn here.

like image 167
dgnorton Avatar answered Sep 27 '22 19:09

dgnorton