首页 > 解决方案 > 在 git status 之前不能 git merge --abort

问题描述

首先我合并某事,然后发生冲突,所以我git merge --abort,但是失败了,我必须先做git status,然后git merge --abort成功。

$ git merge features/test
Auto-merging src/cmd.c
CONFLICT (content): Merge conflict in src/main.c
Auto-merging src/client.c
Automatic merge failed; fix conflicts and then commit the result.
$ git merge --abort
error: Entry 'src/option.h' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'HEAD'.
$ git merge --abort
error: Entry 'src/option.h' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'HEAD'.
$ git status 
# On branch te
# You have unmerged paths.
#   (fix conflicts and run "git commit")
#
# Changes to be committed:
#
**********
#
# Unmerged paths:
#   (use "git add <file>..." to mark resolution)
#
**********
#
$ git merge --abort
$ git status
# On branch te
nothing to commit, working directory clean

我做错了什么吗?

git 版本 1.8.3.1

标签: git

解决方案


我做错了什么吗?

不:git merge --abort应该可以工作,而不必先运行git status。报告您使用的任何 Git 版本的错误。 编辑: 1.8.3.1 确实很古老。如果可能,您应该升级。


推荐阅读