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?
2022-08-15
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?
If you remember which branch was checked out before (e.g. master
) you could simply
git checkout master
to 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
git checkout -
This also tries to check out your last checked out branch.