Git error fatal: cannot do a partial commit during a merge

Dung Do Tien Nov 21 2021 5

Hello guys, I have a small project with .Net Core 3.1 and I push my project into GitLab.

Today I have resolved a conflict source code, I used git commit to helping commit all source change into git but I got an error fatal: cannot do a partial commit during a merge. Like this:

 E:\Project\Quiz\Main\Admin\Source\frontend (Sprint_3_0110_2220/tool_auto_bump -> origin)
λ git commit -m 'merge conflic'
fatal: cannot do a partial commit during a merge.

Before running git commit  I ran git add . but it still throws the error.

Git error fatal: cannot do a partial commit during a merge

Does anyone have any idea for me?

Thanks for any suggestions.

Have 2 answer(s) found.
  • r

    ram Nov 21 2021

    I'm not sure about this case but after I running as below:

    1. Run git pull
    2. Run git add .
    3. Run git commit -m "Commit code"
    4. Finally, run git push

    And it really worked for me.

  • A

    Armin Habibi Nov 21 2021

    You can try to commit all changed files with the command:

      git commit -a

    Don't forget, you have to run the command git add . before.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close