Instructions: in the middle of a git rebase conflict

jdavidb on 2009-10-15T17:55:28

So you've done a git rebase, and a conflict was reported.

The instructions you originally received (which have long since scrolled off your screen), were:

Failed to merge in the changes.
Patch failed at 0051.

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

Thankfully, I can usually remember the --abort switch.

What you haven't been told is:

To get a list of files with conflicts from git, instead of trying to use ack and stuff and picking up false positives:

git status 2>&1 | grep 'needs merge'

After correcting a file with a conflict:

git add FILE

After all the files are added, run a git --rebase continue, without doing a git commit (just in case there was any confusion, and there usually is, for me).

There are a number of other "in the middle of a git conflict" situations that I encounter, none of which are handled the same way, and I hope in time to produce a complete series of instruction cheat sheets for them.


git mergetool FTW

daxim on 2009-10-16T10:20:01

When you have a conflict, run git mergetool. A plain editor cannot handle merging as well as kdiff3.