在 Sourcetree 中开始合并后无法提交 [英] Cant commit after starting a merge in Sourcetree

查看:53
本文介绍了在 Sourcetree 中开始合并后无法提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在合并后尝试提交时,我收到此错误消息:

When trying to commit after a merge I'm getting this error message:

致命:您正在合并 - 无法修改."

"fatal: You are in the middle of a merge -- cannot amend."

我该如何解决这个问题?据我所知,我已经解决了所有冲突,我只需要完成合并并提交更改.但该产品不会让我知道我接下来要做什么,也没有给我任何线索,并且没有完成合并"的选项

How do i resolve this? as far as I know I have resolved all conflicts, i just need to complete the merge and commit the changes. but the product won't let me and doesn't give me any clues as to what I am meant to do next, and there is no option to "complete the merge"

每次我尝试提交更改时,都会收到错误消息,现在我不知道该怎么办!

Everytime I try to commit my changes I get the error message and I now have no idea what to do about it!

推荐答案

您可以手动删除 .git/MERGE_HEAD 并且 Git 将无法判断您只是在进行合并.它会让你像往常一样用索引中的更改来修改之前的提交.

You can manually delete .git/MERGE_HEAD and Git won't be able to tell that you were just doing a merge. It will let you amend the previous commit with the changes in your index just like normal.

虽然这可行,但这是一种黑客行为,不推荐.这里需要的只是让 git 知道合并已完成 git commit -a 根据 this answer

Though this would work, it is a hack and not recommended. All is needed here is to let git know the merge is completed git commit -a as per this answer

这篇关于在 Sourcetree 中开始合并后无法提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆