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.

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.
Otto, yeah, rebase is pretty much the same for git-svn or plain git. The things I mentioned above apply in both cases.
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.
Thanks for writing this up. Very helpful.
I second Charles! Thanks for writing this. Got me out of a tough and confusing spot.
I hit the same problem yesterday. Got major conflicts in a rebase. Luckily I knew I was in a strange "no-branch" situation due to my command prompt always telling me what branch I am in. I'm using Linux and added the following in my ~/.bashrc file
My command prompt now always shows the branch in brackets. Like so:
So if anybody is using Linux and Git, this should be pretty handy to you as well.
I second Charles! Thanks for writing this. Got me out of a tough and confusing spot.
I'm really impressed by your findings here. I'm looking forward to reading more of your writing.
Thanks for writing this up. Very helpful. I second Charles! Got me out of a tough and confusing best car insurance spot.
thanks
great post
Thanks! I needed that.
just do it
Thank you very much Larry, I had this unsolving merge problem since two days. Now it works with your help :-)
so git rebase master left me in a this state with a list of deleted files as un-added.
Thanks for sharing. i really appreciate it that you shared with us such a informative post..
The difference between the right word and the almost right word is really a large matter — it's the difference between a lightning bug and the lightning.
I'm the same way, I do my best to remain neutral. It's hard, if you communicate with the person the other person dislikes, then you fall out of favor with them! I simple can't dislike a person, just because someone else does, I just can't.
I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!
Thanks for sharing. i really appreciate it that..
I second Charles! Thanks for writing this. Got me out of a tough and confusing spot.
thank you for sharing.
I find your blog very informative since i can find answers to all my questions. thanks..good work..
Thanks for taking the time to discuss this,would you mind updating your blog with more information? It is extremely helpful for me.
Thanks for this post, my friend will be so exciting to check this. I really appreciate your work over here
My only complaint about the production is the handling of the chorus.
I have found so many interesting thing in your blog and I really love by going through this post thanks for sharing the info.
Aw, this is a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate a lot and never seem to get something done.
very good looking post, I hope to see more from you soon!
thanks
great info s here
TV Links was a user contributed online video directory for television programme's,films and music videos.
I really liked this post as it is quite informative without any filler content. Looking forward to more such posts in future. Excellent post.
I really find this post up to the mark without any silly unwanted elaboration. All the information has been covered in the right manner. Thumbs up for this post!
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also entertained!