Git/SourceTree 解決冲突 Please commit your changes or stash them before you merge

参考文献:
1.https://juejin.cn/post/6844904105404547086
2.https://www.jianshu.com/p/920ad324fe64
3.https://blog.csdn.net/qq_32452623/article/details/75645578

1.用git pull来更新代码的时候,遇到了下面的问题:

error:
Your local changes to the following files would be overwritten by merge:
xxx/xxx/xxx.(冲突的文件)
Please, commit your changes or stash them before you can merge. Aborting

出现这个问题的原因是多人合作开发的时候,你和其他小伙伴修改了同一个文件导致的。其他人修改了xxx.js并提交到Git版本库中去了,而你本地也修改了xxx.,这时候你进行git
pull就出现冲突了。

2.解决方法

在这里插入图片描述
从sourceTree打开终端,可以直接进入你当前项目所在目录下,在终端输入下面代码:

git stash 
git pull
git stash pop

结果如下:

git stash pop以后,会自动合并冲突文件,并且会提示哪些文件存在冲突

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_40657321/article/details/121331099