在解决 git 变基冲突时提交,无法继续

Made commit while resolving git rebase conflicts, can't continue

我们正在使用 git rebase master 重新设置 git 分支的基址,这时发生了一些冲突。解决冲突后,我的同事(出于习惯)做了 git commit -am "commit msg" 而不是 git add 操作。现在,git rebase 无法继续。我该如何恢复?

$ git branch 
* (no branch)
  groups
  groups_bkp
  master
$ git rebase --continue
Applying: add and remove participants from group
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

事实证明这很简单,我所要做的就是软重置最后一次提交,就像我们 removing the last commit from the current branch 时所做的那样。 (注意此时HEAD指向(no branch)

$ git reset --soft HEAD~1
$ git status 
# Not currently on any branch.
# You are currently rebasing.
#   (all conflicts fixed: run "git rebase --continue")
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   layer.py
#   modified:   __init__.py
#   modified:   leave.py
#   modified:   add.py
#   new file:   add_success.py
#   modified:   remove.py
#   new file:   remove_success.py
#
$ git branch
* (no branch)
  groups
  master

在那之后,我添加了更改并使用 git rebase --continue 继续进行变基,这一切正常

$ git add .
$ git rebase --continue
Applying: add and remove participants from group
$ git branch
* groups
  master

由于冲突很多,我们真的不想使用 git rebase --abort(而且我不确定在提交之后它是否会起作用)