Larry vs. the Git Rebase Merge Conflict

Posted by Larry Karnowski Tue, 10 Jun 2008 12:30:00 GMT

While doing a "git svn rebase", if you have merge conflicts here are some things to remember:

  • While doing a rebase, if anything bad happens, you end up on a "(no-branch)" branch.
  • When doing a "git status", you'll see a ".dotest" file in your working directory. Just ignore it.
  • If you want to bail, do a "git rebase --abort". (Note there is no "git svn rebase --abort".)
  • Fix the merge conflict file manually, then do a "git add [file]".
  • Next do a "git rebase --continue". (Note there's no "svn" version of this either.)
  • If it complains about "did you forget to call 'git add'?", then evidently your edit turned the conflict into a no-op change. Do a "git rebase --skip" to skip it. (Very weird, but true.)
  • Rinse and repeat until the lather is gone, your scalp silky smooth, and the rebase is complete. At any time you can "git rebase --abort" to bail.

What happened to me? Well, I didn't realize what was going on, continued to work on the "not a branch" branch, commited changes, even dcommited changes back to Subversion. It was ugly, but not insurmountable. A buddy clued me into the "not a branch" situation, I was able to get back to my real branch and resurrect my code. It took a few "git rebase --continue" commands, and a tense moment around a "git rebase --skip", but now everything's hunky dory.

This very odd email really helped me a lot. You might be interested at some point.

Tags  | 4 comments

Comments

  1. Otto said about 3 hours later:

    I think I ran into the add thing. Now I know what happened.

    It wasn't a git-svn rebase, but a git rebase master on one of my branches. I still don't understand how that particular change created conflicts. Except maybe in my TextMate project.

  2. larry said about 13 hours later:

    Otto, yeah, rebase is pretty much the same for git-svn or plain git. The things I mentioned above apply in both cases.

  3. Otto said 11 days later:

    Here's what I discovered, there's another way to get that "did you forget to call 'git add'?" message.

    I had deleted some files in both master and the branch, so git rebase master left me in a this state with a list of deleted files as un-added.

    I had to git rm the path, even though they no longer existed, then git-rebase --continue.

  4. Charles Miller said 3 months later:

    Thanks for writing this up. Very helpful.

(leave url/email »)

   Comment Markup Help Preview comment