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

前端 未结 18 1488
长情又很酷
长情又很酷 2020-12-07 07:15

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

18条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 07:30

    Sometimes during the merge, if conflicts arise and there are deltas that need manual resolution. In such case fix the manual resolution for the files mentioned.

    Now if you issue,

    git status Lib/MyFile.php
    

    You will see output like

    On branch warehouse
    Your branch and 'origin/warehouse' have diverged,
    and have 1 and 1 different commits each, respectively.
      (use "git pull" to merge the remote branch into yours)
    
    All conflicts fixed but you are still merging.
      (use "git commit" to conclude merge)
    
    Changes to be committed:
    
        modified:   Lib/MyFile.php
    

    Since, you already staged the commit, you need just issue

    git commit
    

    And your commit will be done without any issue.

提交回复
热议问题