美文网首页
git pull拉取代码报错

git pull拉取代码报错

作者: 程序小白菜 | 来源:发表于2019-07-11 14:08 被阅读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

相关文章

网友评论

      本文标题:git pull拉取代码报错

      本文链接:https://www.haomeiwen.com/subject/hgorkctx.html