文章内容

2019/1/1 11:45:18,作 者: 黄兵

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

最近再是用PyCharm切换分支的时候,出现了如下错误:

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

        .idea/workspace.xml

Please commit your changes or stash them before you switch branches.

Aborting


出现问题的原因:

直接在远程仓库包操作了,修改了github上面的东西,相当于服务器上面的东西,而本地没有修改,当想改变分支的时候,出现了改变分支的时候会重写文件,所以必须把修改的提交到版本库里面。或者是隐藏在你切换分支之前。


解决方案:

抛弃本地的修改,回到上一个版本

git reset --hard
# 然后,切换你的分支
git checkout master 


参考资料:git错误总结


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - Your local changes to the following files would be overwritten by checkout:

分享到:

发表评论

评论列表