not logged in | [Login]

How to fix a Git pull that results in a merge conflict - patch failed

Here's an example.

$ git pull
First, rewinding head to replay your work on top of it...
Applying: Some commit message
Using index info to reconstruct a base tree...
M       some-service/pom.xml
Falling back to patching base and 3-way merge...
Auto-merging some-service/pom.xml
CONFLICT (content): Merge conflict in some-service/pom.xml
Patch failed at 0001 some commit message
The copy of the patch that failed is found in:

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Step 1: Fix the conflicts

Edit each of the files that failed to merge and save them.

vim some-service/pom.xml

Step 2: Git add

Now, for each fixed file, git add it.

git add some-service/pom.xml

Step 3: Continue the rebase

Now just continue the rebase and you are back to normal.

git rebase --continue

Step 4: Relax

Relax, you didn't lose your work.