If one would checkout a branch:
git checkout 760ac7e
from e.g. b9ac70b, how can one go back to the last known head b9ac70b without knowing its SHA1?
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.
If you remember which branch was checked out before (e.g.
master) you could simplyto get out of detached HEAD state.
Generally speaking:
git checkout <branchname>will get you out of that.If you don’t remember the last branch name, try
This also tries to check out your last checked out branch.