error: Your local changes to the following files would be overwritten by checkout:.idea/workspace

error: Your local changes to the following files would be overwritten by checkout:.idea/workspace
错误的下半句
error: Your local changes to the following files would be overwritten by checkout:.idea/workspace
**该分支在git 到远程数据库时 push 了.idea/workspace.xml,该文件在ignore中是默认拦截的所以导致提交不上去。解决办法是删除这个远程服务器中的.idea
**
解决步骤
1.删除远程 .idea文件

$ git rm -r .idea

可能会提示下图的错误。
部分人可能会没有,直接看下一步就好了
我们先结束线程

error: the following file has local modifications:
    .idea/workspace.xml
(use --cached to keep the file, or -f to force removal)

请先结束线程的意思 //路径为系统提示给你的路径我这里是 .idea/workspace.xml

git rm --cached .idea/workspace.xml

error: Your local changes to the following files would be overwritten by checkout:.idea/workspace
整个.idea都是不需要的上传的//路径据自己的更改
结束线程之后再回过头来删除该文件

git rm -r  .idea

error: Your local changes to the following files would be overwritten by checkout:.idea/workspace
看到这里就算成功了第一步

2.
提交一下(提交到本地应该就不会报错了)

$ git commit -m "1122"

然后告诉我们有几个文件删除的信息打印出来

3.
上传代码

git push

之后就可以进行其他操作了。