2

I just tried to rebase one of my feature-branches and something went wrong - now i am trying to figure out how to undo this.

Being on my feature-branch i simply did a: git rebase develop after committing a bugfix on develop which i wanted in the feature-branch as well. This gave me:

$ git rebase develop
First, rewinding head to replay your work on top of it...
Rename from '.git/HEAD.lock' to '.git/HEAD' failed. Should I try again? (y/n)? n

error: Couldn't set HEAD
fatal: Cannot update the ref 'HEAD'.
could not detach HEAD

Well, now i see a bunch of staged files on this branch, but it seems that all commits on this branch are still intact (at least i am not missing one :)

I want to revert this branch to how it looked like before the rebase-attempt. Unfortunately it seems that ORIG_HEAD was not correctly set before the rebase, since i can see it being shown next to a commit on another feature-branch (which i rebased before trying to rebase this feature-branch).

Is a reset to the last visible commit on my current feature-branch the way to go?

--qu

quaylar
  • 2,617
  • 1
  • 17
  • 31
  • Just linking for future ref: http://stackoverflow.com/questions/4660521/recovering-from-a-failed-rebase – quaylar Feb 28 '12 at 12:44

1 Answers1

4

You can use git reflog to see the what commit it was, copy commit number for there and do git reset --hard <number>

Vi.
  • 37,014
  • 18
  • 93
  • 148