Title here
Summary here
A junior developer reports that they checked out a specific commit hash to test a bug, made some fixes, committed them, but now they can’t see their changes on main or any other branch. They are worried they lost their work.
What happened here (technically), and how would you guide them to save their changes and mistakenly “lost” commits to a proper branch?
detached HEAD means HEAD points directly to a commit, not a branch reference. Commits made here are not reachable by any branch tip.git branch temp-fix (creates a branch pointer at the current detached commit).git checkout main (switches back to main).git merge temp-fix (bring changes into main) or create a PR from temp-fix.git checkout -b <name>) before making changes from a specific commit.