What is a detached HEAD?

IntermediateConceptGit
Answer

HEAD points straight at a commit instead of a branch, for example after git checkout <sha> or a tag. New commits there are lost unless you create a branch: git switch -c fix-branch.

All Real-World Interview questions Roadmap: Interview readiness

More on Git