Skip to content

Github Desktop 2.9.4 -> Auto Rebase Triggered - Commits Lost? #24070

Discussion options

You must be logged in to vote

If you git checkout a commit by its hash Git goes into “detached HEAD” state, where you aren’t on any branch at all. That’s also why your feature branch is unchanged: You didn’t reset that branch, you just checked out a commit and reset your working tree to that state.

The easiest way to fix the branch and get out of detached HEAD state is to check out the branch, and then reset it to the correct commit. Double check there aren’t any changes in the working tree that you want to keep before using git reset --hard. ⚠️

git checkout feature-branch
git reset --hard CORRECT_COMMIT_HASH

See: git reset [<mode>] [<commit>]

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment