一种Git冲突:commit your changes or stash them before you can merge 解决方法

2022-07-18

1. 现象

Please, commit your changes or stash them before you can merge.
Please, commit your changes or stash them before you can merge.
Please, commit your changes or stash them before you can merge.

    出现这个问题的原因是其他人修改了已被Git追踪的文件并提交到版本库中去了,而你本地也修改了改文件,但是你事先忘记pull了,此时进行git pull操作就好出现冲突了,解决方法,在上面的提示中也说的很明确了。

(1)保留本地的修改 的改法

git stash
git pull
git stash pop
git stash git pull git stash pop
git stash
git pull
git stash pop

 通过git stash将工作区恢复到上次提交的内容,同时备份本地所做的修改,之后就可以正常git pull了,git pull完成后,执行git stash pop将之前本地做的修改应用到当前工作区。

相关内容
最新

坚持的力量

wordpress建站,视频剪辑拍摄,动画制作