git更新提交失败

问题

在执行git pull 项目更新时发生错误,无法提交和更新
错误信息

Couldn’t save uncommitted changes.
Tried to save uncommitted changes in stash before Update, but failed with an error.
Couldn’t stash file://D:/WORKSPACE/XXXXX: target/classes/META-INF/maven/cn.eova.pro/eova-pro/pom.properties: unmerged (814f3820df4f3229617dc6840a491a8c3dbd1111)
target/classes/META-INF/maven/cn.eova.pro/eova-pro/pom.properties: unmerged (e39b78eab56621d42cdcd34358b218cbbd0f3a11)
git-write-tree: error building trees
Cannot save the current index state

如图:在这里插入图片描述

原因

1、队友在git上提交了target文件
2、更新代码时和本地的target代码产生了冲突,然后我选择的是接收我本地的文件
3、提交代码时,无法提交,然后我clean了本地的target。此时提交、更新代码都不能使用了。

解决方法

1、根据提示:Couldn’t stash file://D:/WORKSPACE/XXXXX: target/classes/META-INF/maven/cn.eova.pro/eova-pro/pom.properties: unmerged。那就找这个文件
2、idea命令框中输入 git status

在这里插入图片描述
3、找到提示的文件,删除这个unmerged的文件
在这里插入图片描述
4、控制台输入 git rm target/classes/META-INF/maven/cn.eova.pro/eova-pro/pom.properties。 当看到如下信息这说明删除ok。
在这里插入图片描述
5、此时再次执行git pull,显示更新成功。
在这里插入图片描述
希望记录当前所踩过的坑来记录自己的成长。

Logo

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

更多推荐