git pull拉取代码报错

2019-07-11  本文已影响0人  程序小白菜

在git合作开发过程中,多人修改同一文件,导致git pull 拉取代码报错

$ git pull
error: Your local changes to the following files would be overwritten by merge:
        config/mount.php
Please commit your changes or stash them before you merge.

方法一: 放弃本地修改,获取上一版本得代码

$ git reset --hard

方法二: 本地修改的代码不能被覆盖

//提交冲突的文件
$ git add "冲突文件"
$ git commit -m '注释'
//拉取文件
$ git pull

方法三:先清除冲突的文件, 在拉去

//n-是文件夹 f-文件
git clean -nf config/mount.php
//运行结果-Removing config/mount.php
git pull
上一篇 下一篇

猜你喜欢

热点阅读