I ran a git pull
that ended in a conflict. I resolved the conflict and everything is fine now (I used mergetool also).
When I commit the resolved file
Looks like you missed -m for commit command
You probably got a conflict in something that you haven't staged for commit. git won't let you commit things independently (because it's all part of the merge, I guess), so you need to git add
that file and then git commit -m "Merge conflict resolution"
. The -i
flag for git commit
does the add for you.
As the error message says you cannot do a partial commit after a merge. Instead of committing just file.php
you should commit all the changes.
This should work.
git commit -m "Fixing merge"
If you are using Source tree or other GUI ensure all files are checked (after merge).
git commit -i -m 'merge message'
didn't work for me. It said:
fatal: No paths with --include/--only does not make sense.
FWIW, I got here via this related question because I was getting this message:
fatal: You have not concluded your merge (MERGE_HEAD exists).
I also tried mergetool, which said No files need merging
. Very confusing! So the MERGE_HEAD is not in a file that needs merging-??
Finally, I used this trick to add only the modified files (did not want to add all the files in my tree, since I have some I want to keep untracked):
git ls-files -m | xargs git add
Then I was finally (!) able to commit and push up. It sure would be nice if git gave you better hints about what to do in these situations.