error: Your local changes to the following files would be overwritten by merge:
程序员文章站
2022-05-14 21:50:46
...
这个错误的字面意思就是你的本地的修改将会被覆盖,
我们的处理方法一般分为两种:
一种是不需要本地的修改,比如一周的的最后一天,一个功能做了一部分,剩下一点实在没做完,然后拿回家里做(博主是直接把代码打包回去的),家里做完后上传提交,然后下周来了,git pull的时候就会碰到这个问题,这个时候其实我已经不需要我本地的修改了,就可以直接通过下面的命令来直接覆盖本地的修改;
git reset --hard
git pull origin master
另一种是还需要的本地的修改,那我们就需要通过git stash来保留下本地的更改,然后git pull拉取远程的代码,最后git stash pop来合并之前修改
git stash //暂存当前正在进行的工作。
git pull origin master //拉取服务器的代码
git stash pop //合并暂存的代码
上一篇: php+ajax实现无刷新分页的方法,ajax分页
下一篇: 9条PHP编程小知识及易犯的小错误
推荐阅读
-
Your local changes to the following files would be overwritten by merge:
-
git 出现 error: Your local changes to the following files would be overwritten by merge
-
git pull error: Your local changes to the following files would be overwritten by merge:
-
git merge 报错:error: Your local changes to the following files would be overwritten by m
-
git 删除本地修改 Your local changes to the following files would be overwritten by merge
-
git pull 提示错误,Your local changes to the following files would be overwritten by merge
-
git:error: Your local changes to the following files would be overwritten by merge:
-
Git出现冲突error: Your local changes to the following files would be overwritten by merge
-
git pull报错:error: Your local changes to the following files would be overwritten by merge:
-
git pull 提示错误,Your local changes to the following files would be overwritten by merge