I was not currently on any branch when I commited my changes.
I didn’t really notice the message and checked out another branch.
How can I retrieve my changes?
I can’t merge or checkout, since there is no branch to merge from.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
git reflogto get the commit hash of the commit that you did while in “no branch” ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)Something like
git merge HEAD@{1}You can also
git rebase -iand “pick” the commit you want from the reflog.