Try it without breaking it
You want to try a dark theme, but the site must keep working while you experiment. A branch is a separate line of commits: experiment there, and main stays exactly as it was.
A parallel universe: Branching splits the timeline. In one universe you redesign the menu; in the other, nothing changed. Later you can merge the universes — or throw the experiment away.
Create, switch, compare
git branch
git switch -c dark-theme
echo "body { background: #111; }" > style.css
git add style.css
git commit -m "Add dark theme"
git log --oneline
git switch main
ls
git log --oneline --all- A branch is just a movable label pointing at a commit. Creating one is instant and free.
- Name branches after what they do: add-contact-form, fix-price-typo.
- Commit or stash your changes before switching, or Git may refuse to switch.