Contents

Engineering Craft › Version Control (Git)

Version Control

Tracking every change to code so you can review, revert and collaborate.

Also known as: VCS, source control, revision control, SCM

Version control is a system that records every change to your files over time, so you can see what changed, who changed it and why, compare versions, and go back to any earlier state. It’s the foundation of teamwork on code.

Without it, you end up with report_final_v2_REAL.docx, overwritten work and no history.

What it gives you

  • History: every change with an author, a date and a message (commit, git log).
  • Undo: restore an old version, or revert a bad change (git revert).
  • Collaboration: many people work at once on separate branches, then combine their work (merge).
  • Review: changes are proposed and discussed before they land (pull requests).
  • Experiments: try an idea on a branch with no risk to the working version.
  • Traceability: find when a bug appeared (git bisect, git blame).
  • Backup and sharing: copies live in more than one place (remotes).

Two models

Centralized (SVN, older tools)Distributed (Git, Mercurial)
Where the history liveson one serverin every clone
Offline worklimitedfull: commit, branch and browse offline
Branchingheaviercheap and routine

Git is by far the most common today (Git).

What belongs under it

Source code, tests, configuration, documentation, build scripts, infrastructure definitions (infrastructure as code), and database migrations. Not secrets (secrets in Git), build output or large generated files.

Good habits

  • Commit often, with clear messages (commit messages).
  • Use branches and pull requests for shared code.
  • Treat history as valuable. Don’t rewrite shared branches.

Version control isn’t only for code. Writers, designers and data teams use it too.