Code & computing / QUICK REFERENCE

Everyday Git

The small set of commands for seeing changes, saving work and understanding your history.

Starter exampleRevision 1Updated Git CLI · local workflow

Look before you change

Working tree overview
git status

See staged, unstaged and untracked files. [1]

Unstaged changes
git diff

Compare tracked working-tree changes with the staging area. Untracked file contents are not included. [1]

Staged changes
git diff --cached

Compare staged changes with the current commit. [1]

Recent commits
git log --oneline -5

Show a compact list of the five most recent commits reachable from the current branch. [1]

Save a deliberate snapshot

Create a repository
git init

Initialize Git in the current directory. Run once for a new project. [1]

Stage one file
git add notes.txt

Stage the current contents of this file. Later edits must be staged again. [1]

Commit staged changes
git commit -m "Describe the change"

Create a commit containing what is staged, not every edit in the working tree. [1]

List local branches
git branch

List local branch names. The current branch is marked with an asterisk. [1]

PROVENANCE, NOT A PROMISE

Sources & verification

Primary-source tutorial checked during preparation. The repository test suite exercises this local inspect/add/commit workflow in a disposable repository; it does not test every Git version, remote hosting service or merge scenario.

Independent review pending. This sheet was prepared with AI assistance. Source checks and automated tests do not establish universal correctness.

  1. Git tutorial ↗Git project · accessed 2026-10-19