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

2.1K    Asked by DylanPEREZ in Devops , Asked on Feb 23, 2021

I ran a git pull that ended in conflict. I resolved the conflict and everything is fine now (I used merge tool 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.

Answered by Dylan PEREZ

By adding "- I" to the submit command would fix this issue for you. Fundamentally, in straightforward terms the - I advises git to arrange extra documents prior to submitting them without unequivocally utilizing the git add command, this way:

git commit -i myfile.php



Your Answer

Interviews

Parent Categories