无法进行git merge-中止直到git status

Sat*_*ato 5 git

首先,我合并某物,然后发生冲突,所以我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
Run Code Online (Sandbox Code Playgroud)

我做错了什么吗?

git版本1.8.3.1

Er *_*oni 6

首先,我们需要运行

git status
Run Code Online (Sandbox Code Playgroud)

然后

git merge --abort
Run Code Online (Sandbox Code Playgroud)


Jef*_*oli 5

运行此命令将丢失所有尚未提交的更改!

git reset head

git checkout -- .
Run Code Online (Sandbox Code Playgroud)

在此处阅读有关如何git reset head运作的更多信息


tor*_*rek 3

我做错了什么吗?

不:git merge --abort应该已经有效,无需git status先运行。报告您正在使用的 Git 版本的错误。 编辑: 1.8.3.1 确实很古老。如果可能的话,您应该升级。