git detached head state - ghdrako/doc_snipets GitHub Wiki
If HEAD isn't a branch and is acommit instead - ist name detached HEAD state
Some way HEAD can become comit ID
git checkout <commit-id>
git checkout origin/main # remote tracking branch
git checkout v1.3 # tag
It's a great way to look on old version of code.
The only problem is when make commit because is orphaned and can be deleted by git gc. To fix thisjust create new branch:
git switch -c newbranch