Skip to content

Git

The distributed version control system almost everyone builds on.

Version Control

Git tracks changes to a codebase as a graph of commits, each a snapshot with a pointer to its parent(s). Unlike older centralized systems, every clone is a full copy of the project's history, which is what makes branching, merging, and offline work cheap. Nearly all modern hosting (GitHub, GitLab, Bitbucket) and CI/CD tooling is built around it.

When to use it

  • Essentially every software project benefits from version control — this isn't really an optional decision anymore
  • You're collaborating with others and need a reliable way to merge concurrent work
  • You want a full history of a project, with the ability to find when and why any line changed

Considerations

  • The mental model (commits, branches, the staging area, remotes) takes real time to internalize — most Git confusion comes from an incomplete mental model, not the tool being arbitrary
  • Some operations (interactive rebase, reflog recovery) are powerful but genuinely dangerous without understanding what they do first
  • Large binary files (video, design assets) don't fit Git's model well without an add-on like Git LFS

Key concepts

Commits

An immutable snapshot of the repository at a point in time, with a message, author, and pointer to its parent commit(s).

Branches

A movable pointer to a commit — creating a branch is cheap (just a new pointer), which is what makes Git's branching model fast.

The staging area (index)

A middle step between your working files and a commit — git add stages changes, git commit records what's staged.

Remotes

A reference to another copy of the repository (usually on a host like GitHub) that you push to and pull from.

Getting started

git init

Start tracking a new project with Git.

git add . && git commit -m "Initial commit"

Stage everything and make the first commit.

Common mistakes

  • Running git push --force on a shared branch — rewrites history other people have already based work on, and can silently discard their commits.
  • Committing large binary files (videos, design assets) directly instead of using Git LFS — the repository grows and slows down permanently, even after the file is later removed.
  • Using interactive rebase or resetting history without understanding what it does first — most Git confusion comes from an incomplete mental model, not the tool being arbitrary, and these operations are genuinely capable of losing work.

Ecosystem

GitHub / GitLab / Bitbucket (hosting)GitHub Actions / GitLab CI (CI/CD)Git LFS (large file storage)Conventional Commits (message convention)

This guide states trade-offs, not a single "best" answer — the right choice depends on your team, constraints, and existing stack.