今天在更新项目的时候发生错误,调试了很长时间都不能解决。
错误原因:
Couldn't save uncommitted changes.
Tried to save uncommitted changes in stash before Update, but failed with an error.
Couldn't stash file://H:/IdeaProjects/SVSP_0.4: git-write-tree: error building trees
Cannot save the current index state
经过逐步排查发现是同事上传了多余的文件造成了集体无法更新,解决方案如下:
- 进入你的项目目录,我的目录是:
H:\IdeaProjects\SVSP_0.4
,右键选择Git Bash here - 输入
git status
会看到如下信息,注意是Unmerged paths这一段
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git rm <file>..." to mark resolution)
both deleted: .idea/artifacts/SVSP0_4.xml
- 找到原因,是上传了多余的文件,需要删除
both deleted:
后面的.idea/artifacts/SVSP0_4.xml
这个文件 - 输入
git rm .idea/artifacts/SVSP0_4.xml
- 再次进入IDEA更新即可解决问题