Skip to main content
Junior

Losing Your Head, or Detached HEAD

Junior

Task

HEAD is currently attached to the bugFix branch, which points to commit C4. Switch directly to commit C4.

Requirements

  • Put HEAD into a detached state.
  • Do not move the main and bugFix branches.

Expected result

HEAD must point directly to C4, and the bugFix branch must still point to the same commit.

What you will learn

After completing the task, you will be able to:

  • tell a HEAD attached to a branch apart from a detached HEAD;
  • check out a specific commit;
  • understand why such a checkout does not move a branch.
Goal
localC0C1C2mainC3C4bugFix HEAD
Git trainer0 commands
terminal
localC0C1C2mainC3C4HEAD bugFix