IDEA更新失败问题:Couldn't save uncommitted changes 解决方案

今天在更新项目的时候发生错误,调试了很长时间都不能解决。
错误原因:

  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

经过逐步排查发现是同事上传了多余的文件造成了集体无法更新,解决方案如下:

  1. 进入你的项目目录,我的目录是:H:\IdeaProjects\SVSP_0.4,右键选择Git Bash here
  2. 输入git status会看到如下信息,注意是Unmerged paths这一段
Unmerged paths:
  (use "git reset HEAD ..." to unstage)
  (use "git rm ..." to mark resolution)
        both deleted:    .idea/artifacts/SVSP0_4.xml
  1. 找到原因,是上传了多余的文件,需要删除both deleted: 后面的 .idea/artifacts/SVSP0_4.xml这个文件
  2. 输入 git rm .idea/artifacts/SVSP0_4.xml
  3. 再次进入IDEA更新即可解决问题

你可能感兴趣的:(Java)