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

1

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.