Unit 08 · lesson

Branches

A branch lets a line of development move without immediately changing another branch's current tip.

Do not treat branches as mystical parallel universes.

They are movable references into commit history.

Inspect branches

git branch

Create a bounded feature branch using the workflow your Git version/team prefers, for example:

git switch -c improve-project-page

Make one real change.

Commit it.

Visualize history

git log --oneline --graph --decorate --all

You should see the branch labels pointing to commits.

Why branches help

A branch can isolate:

  • a layout refactor;
  • a theme experiment;
  • deployment workflow changes;
  • final accessibility fixes.

If the experiment is bad, you do not have to pretend it never happened. You can compare or abandon the branch without merging it into the main line.

Branch name as communication

Prefer names that describe the work:

fix-baseurl-links
add-project-collection
improve-keyboard-focus

over:

branch2
new
stuff

Failure boundary

Switching branches changes the checked-out source state.

If the browser suddenly looks different after switching, check which branch/version you are serving before assuming Jekyll rebuilt incorrectly.

Checkpoint

Create one branch, make/commit one coherent change, and show the graph before merging anything.