git相关问题

快照问题

问题描述 :本地存在快照,然后跟远程冲突了,会出现拉取不了,提交不了

问题案例:

error: Your local changes to the following files would be overwritten by merge:


question-study-improve.iml



Please commit your changes or stash them before you merge.



Aborting


git相关问题-Your local changes to the following files would be overwritten by merge_解决方案

解决方案:

  • 需要保存本地快照代码:
git stash  
git pull origin master
git stash pop

git相关问题-Your local changes to the following files would be overwritten by merge_本地代码_02

做完上面的几部操作后,远程的代码一般都会更新下来,接下来只要做你自己的操作就行了,一般就是将本地的代码push到远程;

  • 丢弃本地代码:这里就是直接回退版本
git reset --hard 
git pull origin master