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 stash // 先存储
 git pull // 拉代码
 git stash pop // 再pop出来
 然后可以使用git diff -w +文件名 来确认代码自动合并的情况

如果希望用代码库中的文件完全覆盖本地工作版本.
 git reset --hard
 git pull

其中git reset是针对版本,如果想针对文件回退本地修改,使用
git checkout HEAD file/to/restore

猜你喜欢

转载自sunj.iteye.com/blog/2378743