问题
当 git pull 时,如果有冲突,那么除了冲突文件,其它文件都会做为staged区的文件保存起来。
重现
$ git pull
A app/controller/index.js
A app/controller/home.js
M app/view/index.art
......
A app/static/css/common.css
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
解决
- git reset --hard FETCH_HEAD
将本地的冲突文件冲掉,不仅需要reset到MERGE-HEAD或者HEAD,还需要--hard。没有后面的hard,不会冲掉本地工作区。只会冲掉stage区。
- git pull