简体   繁体   English

'git commit'和'git status'矛盾

[英]'git commit' and 'git status' contradicting

'git status' command gives this message: 'git status'命令显示以下消息:

All conflicts fixed but you are still merging. 所有冲突已解决,但您仍在合并中。

(use "git commit" to conclude merge) (使用“ git commit”结束合并)

But when I try to commit, I face an issue: 但是当我尝试提交时,我遇到了一个问题:

git commit --amend --no-edit git commit --amend --no-edit

fatal: You are in the middle of a merge -- cannot amend. 致命的:您正在合并中-无法修改。

What's the issue here? 这里有什么问题?

You started a merge action which is not finished. 您启动了尚未完成的合并操作。 To finish it, call 要完成此操作,请致电

git commit

Once your merge is finished, you can amend your last commit by typing 合并完成后,您可以通过键入以下内容来修改上一次提交

git commit --amend

The error message is pretty clear: 错误消息非常清楚:

fatal: You are in the middle of a merge -- cannot amend. 致命的:您正在合并中-无法修改。

Where is the contradiction? 矛盾在哪里? The error message reported by git commit clearly says: you cannot amend because you are in the middle of a merge. git commit报告的错误消息清楚地表明:您无法修改,因为您处于合并的中间。

Run git commit without other arguments to conclude the merge. 运行不带其他参数的git commit结束合并。

You can add --no-edit if you don't want to modify the default commit message produced by git merge but --amend doesn't make any sense. 如果不想修改git merge产生的默认提交消息,可以添加--no-edit ,但是--amend没有任何意义。 You can amend an existing commit but since your merge failed, a commit has not yet be created (and consequently there is nothing to amend). 您可以修改现有的提交,但是由于合并失败,因此尚未创建提交(因此没有要修改的内容)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM