Version Control Basics for One Person
Version control is usually taught as a team tool. It is just as valuable alone: it is an undo button that spans months and a diary you did not have to remember to write.
What it actually is
Version control is a system that records the state of a set of files at moments you choose, and lets you compare or return to any of those moments. The most widely used tool today is Git, and the examples here use its vocabulary, but the ideas are older than any one tool and carry over to others.
Without version control, people invent it badly: folders named "final", "final2", and "final-really". Version control replaces that with one folder and a history. The history lives in a hidden directory alongside your files, which is called a repository.
The commit is the unit
A commit is a saved snapshot with a message attached. The skill of version control is mostly the skill of choosing good commits. A good commit does one thing: it adds one feature, fixes one bug, or renames one set of things. When a commit does one thing, you can describe it in a short message, and you can undo it later without undoing something unrelated.
Git adds a step that confuses newcomers: the staging area. Before committing, you choose which changes go into the snapshot. This exists precisely so that you can make commits that do one thing, even if you edited several things at once. Think of it as laying out what goes into the envelope before sealing it.
Write messages for a stranger
The stranger is you, in half a year. A message such as "fix" or "changes" tells that person nothing. A useful message has a short first line saying what the commit does, written as an instruction: "Handle empty input in the parser". If the reason is not obvious, add a second paragraph saying why. The code already shows what changed; the message is the only place to record why.
Branches are cheap experiments
A branch is a separate line of history. Branching lets you try an idea without disturbing the version that works. If the idea succeeds, you merge the branch back. If it fails, you delete the branch and nothing is lost. For a solo learner this removes much of the fear of breaking a working program: make a branch, break things freely, and decide afterwards whether to keep any of it.
Look before you leap
Two commands are worth running constantly. One shows the status: which files have changed, which are staged, which are new. The other shows the difference: the exact lines added and removed. Reading the difference before every commit is the single best habit in version control. It catches the leftover debugging print, the accidental deletion, and the file you did not mean to include.
- Check status and read the difference before each commit.
- Commit small, and commit when something works.
- Use a branch for anything you are unsure about.
- Write the message for someone with no memory of today.
What should not go in
Not every file belongs in the history. Generated files, downloaded dependencies, and editor settings add noise. Passwords and keys add danger, because history is hard to erase: once a secret has been committed and shared, deleting the file in a later commit does not remove it from earlier ones. Git reads a file of patterns to ignore; set it up on the first day of a project and list anything secret or generated in it.
A remote copy is a backup, and more
A repository on your own machine protects you from mistakes, but not from a failed disk. Pushing your history to a hosting service gives you a second copy and a way to work from another computer. It also lets other people read your code, so check which of your repositories are public before you push anything you would not want read.
Do not fear the history
Beginners worry about damaging the repository. In practice it is difficult to lose committed work, because the system is designed to keep it. The work at risk is the work you have not committed yet. That is the practical argument for committing often: everything saved in a commit can be recovered, and everything outside one depends on your editor's undo.
The commands that deserve caution are the few that rewrite or discard history, and they usually carry words such as "force" or "hard" in their options. When a command contains one of those words, stop and read what it will do before pressing Enter.
Working rule: commit whenever the program works a little better than it did at the last commit. Small steps make every later mistake cheap.
Last revised 2026-11-20 · Wendell Arkwright