Recall & Review
beginner
What is the Detached HEAD state in Git?
It means you are not on any branch but on a specific commit. Changes made here won't update any branch until you create one or move a branch pointer.
Click to reveal answer
beginner
How do you enter Detached HEAD state?
By checking out a commit directly using its hash or a tag instead of a branch name.
Click to reveal answer
intermediate
What happens if you make commits in Detached HEAD state and then switch branches without saving?
Those commits can be lost because no branch points to them unless you create a new branch or tag to save them.
Click to reveal answer
beginner
How can you save work done in Detached HEAD state?
Create a new branch from the current commit using 'git switch -c ' or 'git checkout -b '.
Click to reveal answer
intermediate
Why might someone want to use Detached HEAD state?
To explore or test a past commit without affecting branches, or to build and test code at a specific point in history.
Click to reveal answer
What does Detached HEAD state mean in Git?
✗ Incorrect
Detached HEAD means you checked out a commit directly, not a branch.
How do you enter Detached HEAD state?
✗ Incorrect
Checking out a commit hash puts you in Detached HEAD state.
What happens to commits made in Detached HEAD if you switch branches without saving?
✗ Incorrect
Commits in Detached HEAD are lost if not saved to a branch or tag.
Which command saves your work from Detached HEAD state to a new branch?
✗ Incorrect
git switch -c creates a new branch from current commit.
Why use Detached HEAD state?
✗ Incorrect
Detached HEAD lets you explore or test commits without changing branches.
Explain what Detached HEAD state is and how you can safely save work done in this state.
Think about checking out commits and branch creation.
You got /3 concepts.
Describe a scenario where Detached HEAD state is useful and what risks it carries.
Consider testing old commits and saving changes.
You got /3 concepts.