git三个位置:本地硬盘(当前工作目录)—缓存区(stage/index)—版本区(.git)
总结:出现问题的原因——将workspace.xml文件提交到缓存区了,commit不了,导致update项目也失败;
思考背后的原因:workspace.xml不能提交到版本库,只能放在本地;
解决思路:
1)首先,删除缓存区里面存在的xml配置文件,但本地硬盘不删除,git rm --cached ./idea/workspace.xml
2)从缓存中移除文件——撤销之前将正常py文件提交到缓存区,git reset HEAD  biz/integration_ap/improved_feature_deal_shixin_svc.py
3)再git status检查一下,出现nothing to commit就表示git可以进行push和update了;
参考重要关键教程————Git详细使用教程链接:[Git详细使用教程](https://blog.csdn.net/tgbus18990140382/article/details/52886786)
4)退出git log,英文状态下按Q;
添加文件到缓存 git add
提交代码到本地仓库 git commit
从缓存中移除文件 git reset HEAD
从缓存以及工作目录删除文件 git rm
git rm 会将条目从缓存区中移除。这与 git reset HEAD 将条目取消缓存是有区别的。 
“取消缓存”的意思就是将缓存区恢复为我们做出修改之前的样子。
默认情况下,git rm file 会将文件从缓存区和你的硬盘中(工作目录)删除。
如果你要在工作目录中留着该文件,可以使用 git rm –cached: 

sc@sc-All-Series:~/PycharmProjects/risk-model$ git status
On branch 4.0.0-dev
Your branch and 'origin/4.0.0-dev' have diverged,
and have 2 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   .idea/dataSources.ids
    new file:   .idea/dataSources.local.xml
    new file:   .idea/dataSources.xml
    new file:   .idea/workspace.xml

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git rm <file>..." to mark resolution)

    both deleted:       biz/integration_api/features_deal_shixin_svc.py
    both deleted:       biz/integration_api/improved_feature_deal_shixin_svc.py

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    .idea/dataSources.ids
    deleted:    .idea/dataSources.local.xml
    deleted:    .idea/dataSources.xml
    modified:   .idea/workspace.xml

sc@sc-All-Series:~/PycharmProjects/risk-model$ rm .idea/workspace.xml
sc@sc-All-Series:~/PycharmProjects/risk-model$ 
查看有.idea/workspace.xml
还有一些已经删除的py文件;
首先git status;
然后git rm --cached .idea/workspace.xml  ,删除xml
然后git reset HEAD  biz/integration_api/improved_feature_deal_shixin_svc.py
然后再git status检查一下:
sc@sc-All-Series:~/PycharmProjects/risk-model$ git status
On branch 4.0.0-dev
Your branch and 'origin/4.0.0-dev' have diverged,
and have 2 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean

就可以update 项目了;可以看图标!
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐