Instiq
Chapter 2 · Working with Repositories·v1.1.0·Updated 6/15/2026·~8 min

What's changed: Expanded content (added diagrams)

2.2Recording Changes (add, commit, diff, log)

The heart of daily Git work is recording changes and inspecting state.

■ Recording • git add <file> = place changes into the staging area (selecting what goes into the next commit). • git commit -m "message" = finalize staged changes into local history. A plain git commit records only staged changes; edited-but-unstaged changes are not committed. The -a (-am) option auto-stages tracked files (but not new files). Commit in meaningful units and write messages that convey what and why.

■ Inspecting state and diffs • git status = show changes/staging status and the current branch. • git diff = show not-yet-committed changes (--staged for staged changes). • git log = list commit history (author, date, message); --oneline shows a compact one-line-per-commit view.

■ Tracing and sharing • git blame <file> = show who changed each line and when, to trace how code evolved. • git push = publish your local commits to a remote (e.g., origin) to share with others. Committing and pushing frequently improves safety and makes collaboration smoother.

Diagram

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. Which command shows uncommitted changes (the diff)?

Q2. Which command lists commit history?

Check your understandingPractice questions for Chapter 2: Working with Repositories