git rm --cached (解决:modified: .idea/workspace.xml,git idea 操作完之后不能pull)

版权声明:本文为作者原创,转载请注明出处,联系qq:32248827 https://blog.csdn.net/dataiyangu/article/details/84998558

错误解决:modified: .idea/workspace.xml

这个错误是本地的.idea提交到了远端。
解决办法:

.gitignore文件加上:

.dea/workspace.xml
可是.gitignore文件生效的时机是在git add,我们的文件已经提交到了远端的话,.gitignore是不生效的。

git rm --cached file

执行git rm --cached file先将远端的文件删除,然后在

git add .                  git commit -m              git pull 

恢复文件

删除.gitignore中添加的内容,就能重新提交。

拓展:三个删除:

rm

普通删除

git rm

删除本地、暂存区、分支上内容

git rm file = rm file+ git add file

rm file删除本地文件
git add file 提交删除的步骤同步到git仓库

rm 只是删除本地的文件,并没有把这个操作同步到git上。

git rm --cached file

删除暂存区、分支上内容,本地保留。解除该文件的追踪关系,脱离版本控制。

git rm --cached

他可以把已经提交到远端的文件,删掉。

猜你喜欢

转载自blog.csdn.net/dataiyangu/article/details/84998558
今日推荐