问题
I've got myself into a muddle via an interactive rebase, and I now wish to abort it. (i.e. go back to the point before I was dropped into interactive rebase mode, in my case via git pull --rebase
.) The way to do this seems to be via git rebase --abort
, but this doesn't work:
$ git rebase --abort
error: Ref refs/heads/master is at 55b388c141b1485b1acd9e050dbeb0eb90ef2ee7 but
expected b918ac16a33881ce00799bea63d9c23bf7022d67
fatal: Cannot lock the ref 'refs/heads/master'.
Could not move back to refs/heads/master
How can I get out of interactive rebase mode, and clean up all references to it? (git reset --hard
succeeds, but doesn't drop me out of rebase mode.)
回答1:
Try to follow the advice you see on the screen, and first reset your master's HEAD to the commit it expects.
git update-ref refs/heads/master b918ac16a33881ce00799bea63d9c23bf7022d67
Then, abort the rebase again.
来源:https://stackoverflow.com/questions/5104649/how-to-abort-an-interactive-rebase-if-abort-doesnt-work