When I run git status
, this is what I am seeing:
$ git status
On branch master
Your branch is ahead of \'origin/master\' by 1 commit.
(use \"g
fix conflicts
Do a git diff
to see if you have any merge marker, like:
$ git diff hello.txt
diff --cc hello.txt
index 5eb9649,379bd44..0000000
--- a/hello.txt
+++ b/hello.txt
@@@ -1,1 -1,1 +1,7 @@@
++<<<<<<< HEAD
+Hello, master change.
++||||||| merged common ancestors
++Hello, Original.
++=======
+ Hello, branch b1 change.
++>>>>>>> b1
If not, try and reapply git am with the -3
option: git am -3
If you have, do, for instance using kdiff3 (Windows or Linux), git mergetool --tool=kdiff3
. That will launch a graphical tool allowing you to chose between local, base and remote
+--------------------------------+
| BASE | LOCAL | REMOTE |
+--------------------------------+
| MERGED |
+--------------------------------+
With:
LOCAL
: A temporary file containing the contents of the file on the current branch.BASE
: A temporary file containing the common base for the merge.REMOTE
: A temporary file containing the contents of the file to be merged.MERGED
: The file containing the conflict markers.The git am --continue
should only be done when git status doesn't report any unstaged files.
See more with Git Conflict Resolution by Ted Felix: it has this handy summary:
- Always use "
-3
" with "git am
" to make sure you get conflict markers.- Use "
git status
" and "git diff
" to find out what went wrong.- Resolve the conflicts by any of the following methods:
- Edit each conflicting file with your favorite editor.
- "
git checkout --theirs
" or "git checkout --ours
".- "
git checkout -m
" to undo conflict resolution on specific files. (BE CAREFUL!)- "
git mergetool
" and an appropriate merge GUI tool likekdiff3
.- "
git add
" the resolved files.- "
git am --continue
" to continue the am.
With Git 2.17 (Q2 2018), don't forget to start your git am session with git am --show-current-patch
to get a better view of the path to edit in case of conflict.
See "Show current git interactive rebase operation".