Git- Fatal: cannot do a partial commit during a merge

发布时间 2023-12-25 13:48:27作者: 以后。h

在提交单个文件的时候出现这个错误. 意思是不能部分提交代码.

原因是git认为你有部分代码没有做好提交的准备, 比如没有添加

解决方法是

1. 提交全部 git commit -a

2. 如果不想提交全部,那么可以通过添加 -i 选项 git commit file/to/path -i -m merge 

git commit -m  ''


另:

git status // 看看git里的状态,是冲突的有哪些文件等

git show | head // 查看commit进去的是谁、日期等