Detached HEAD
Checking out a commit instead of a branch gives a detached HEAD. Create a branch to keep work.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt && git commit -qam 'second'
git checkout -q HEAD~1
git branch --show-current | wc -c
git switch -q -c rescue
git branch --show-currentResult
0 rescue
Exercise
Keep detached work.
git switch name
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.