Tag Archives: git merge

Merging is not possible because you have unmerged files


git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches, git merges branches

When I was doing project work, my colleague modified a CPP code, and I also modified the code. The two codes clashed. After submission, his code git merged automatically and was prompted: [master| MERGEING]

$ git merge my_new_branch
error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

or error:

Auto-merging src/ui/menu/wizardGroup.c
Auto-merging src/ui/menu/drawmenu5.c
Auto-merging src/ui/menu/drawmenu3.c
Auto-merging src/ui/menu/drawmenu2.c
Auto-merging src/ui/menu/drawmenu1.c
Auto-merging src/ui/menu/drawmenu0.c
Auto-merging src/string/language_d.h
CONFLICT (content): Merge conflict in src/string/language_d.h
Auto-merging src/string/languageDict.h
CONFLICT (content): Merge conflict in src/string/languageDict.h
Auto-merging src/drawui.c
Auto-merging src/dev/dev_phascan.c
Auto-merging src/dev/dev_flexscan.c
Auto-merging src/callback.c
Automatic merge failed; fix conflicts and then commit the result.

* solution:

If you have fixed the files you need to add the files to the stage with git add [filename], then commit as normal. Git add [modified conflicting files], and finally, commit the conflicting issues as normal: git commit [modified conflicting files] -m “comment content”

* is simply:

  • use git diff or git status to check which files are in conflict, the conflict will prompt:

++< < < < < < < HEAD

++< < < < < < < new_branch

  • modify your conflicting files, after the modification, save.

  • use git add XXX and add all the files you have modified.

  • finally, with git commit-a-m “note information” commit, complete.