Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git error on commit after merge - fatal: cannot do a partial commit during a merge

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 with git commit file.php -m "message" I get the error:

fatal: cannot do a partial commit during a merge. 

I had the same issue before and using -a in commit worked perfectly. I think it's not the perfect way because I don't want to commit all changes. I want to commit files separately with separate comments. How can I do that? Why doesn't git allow users to commit files separately after a merge? I could not find a satisfactory answer to this problem.

like image 725
pMan Avatar asked Apr 29 '11 04:04

pMan


2 Answers

I found that adding "-i" to the commit command fixes this problem for me. The -i basically tells it to stage additional files before committing. That is:

git commit -i myfile.php 
like image 143
MikaelHalen Avatar answered Sep 23 '22 15:09

MikaelHalen


git commit -am 'Conflicts resolved' 

This worked for me. You can try this also.

like image 26
Pratip Ghosh Avatar answered Sep 21 '22 15:09

Pratip Ghosh