Lesson 02 of 06Concept
Understanding HEAD
Goal: Know what HEAD is and how it moves when you commit and switch branches.
"You are here"
With several branches, Git needs to know which one you are working on. That is HEAD: a pointer to your current branch.
HEAD points at a branch, and the branch points at a commit. So HEAD also tells Git which commit your working tree is based on.
HEAD ──▶ main ──▶ ● Add styles
│
● Add homepage
│
● Initial commitgit status reports this as On branch main.Follow HEAD
Step 1 of 4
HEAD is on main. A second branch, feature/login, points at the same commit.
Step 1 of 4. HEAD is on `main`. A second branch, `feature/login`, points at the same commit.
Spotting HEAD
$ git log --oneline
4b7d2e1 (HEAD -> main, feature/login) Add homepage a3f0c47 Initial commit
HEAD -> main means HEAD points to main. feature/login points at the same commit. In the GitDojo graph, HEAD is the blue label.
