git发生冲突:error: Your local changes to the following files would be overwritten by merge
Posted 52lnamp
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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: xxx/xxx.php Please commit your changes or stash them before you merge.
Aborting
出现这个情况是因为他人修改的xxx.php文件并提交到git库,与你本地的修改发生了冲突所以 git pull 失败,可以使用 git stash 解决:
1.通过 git stash 备份本地的修改,同时将工作区恢复到上次提交
git stash
2.使用 git pull 将git库代码拉取到本地
git pull
3.使用 git stash pop 将之前备份的修改在 git pull 拉取之后的基础上恢复到工作区
git stash pop
到这里就可以正常提交自己本地的代码库啦
git add -A git commit -m ‘ ‘ git push
如果存在多个备份可使用 git stash list 查看, git stash clear 清除所有备份
以上是关于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: xxx/...
Laravel 5.2--git冲突error: Your local changes to the following files would be overwritten by merge:(示例
git 常见冲突—— git pull遇到报错Your local changes to the following files would be overwritten by merge
error: Your local changes to the following files would be overwritten by checkout:
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