Skip to content

Version Control

Version control keeps a history of your work. It lets you experiment freely because every previous state can be recovered, and it makes collaboration far less fragile.

Commits as checkpoints

A commit is a saved snapshot with a short message. Make commits small and related, so each one describes a single idea you can explain.

Write the message in the form "add", "fix", or "update" followed by what changed. Future you will be grateful for the detail.

Branches for experiments

A branch is a separate line of work. Use one for a new feature or a risky change, so the main line stays stable while you experiment.

Merge a branch back when it works and has been checked. Delete branches you no longer need to keep the list readable.

Recovering earlier work

The history is your safety net. If a change breaks something, you can compare versions and return to the last point that worked.

Commit before a large refactor. That way, the moment before the risky change is always one step away.

Common actions

Action When to use it Tip
Commit After a working change Keep messages short
Branch Before an experiment Name it by purpose
Compare When behaviour changes Read the diff slowly