git Please move or remove them before you can merge. 错误解决方案

Posted tochw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git Please move or remove them before you can merge. 错误解决方案相关的知识,希望对你有一定的参考价值。

合并分支或者git pull命令的时候遇到:

Updating 7c9e086..936acac
error: The following untracked working tree files would be overwritten by merge:
Common/HFHttpRequest/HFHttpRequestParameters.h
Common/HFHttpRequest/HFHttpRequestParameters.m

Please move or remove them before you can merge.
Aborting

 解决方法,项目根目录下运行git命令

$git clean -d -fx .

x -----删除忽略文件已经对git来说不识别的文件

d -----删除未被添加到git的路径中的文件

f -----强制运行

注意:会把硬盘中,很多未被跟踪的文件会被删除!特别是新建的文件。

以上是关于git Please move or remove them before you can merge. 错误解决方案的主要内容,如果未能解决你的问题,请参考以下文章