Git is a time machine for beginners

You don't need to understand branches and rebases to get the best part of git: an undo button for your whole project.

  • Tools

A git graph with two branches splitting off a main line and merging back

Version control has a scary reputation. Most of what makes it scary is stuff you won't need for a small project. The useful core fits in four commands.

The four commands

git init                  # start tracking this folder
git add .                 # stage everything that changed
git commit -m "message"   # save a snapshot
git checkout .            # throw away changes since the last snapshot

That's it. Commit every time something works. When an experiment goes wrong, roll back to the last good snapshot and try again.

Why it matters more with AI

An AI editor can change ten files in a second. That speed is great when the change is right and painful when it isn't. With a commit before each request, a bad answer costs you nothing.

Commit when it works. Experiment freely. Roll back without fear.

Good commit messages

Write the message for the person who will read it in a month (probably you). "Changed fonts to Fraunces and Inter" beats "stuff". When you need to find the point where something broke, those messages are your map.