Posts

Git Cheat Sheet – Part 1: The Basics

A working reference for everyday Git, built from my notes on Pro Git (Chapters 1–2) and tested on Fedora with Git 2.49. 1. The Mental Model Three sections of a Git project Section What it is Working tree One checked-out version of the project, on disk, where you edit files. Staging area (index) A single binary file, .git/index . Lists every tracked path and the blob hash of its staged version: the "packing list" for the next commit. Repository ( .git ) The object database (blobs, trees, commits, tags), refs, HEAD, the index and local config. The whole history lives here. File states State Meaning Untracked Git has never been told about it. Not in the last commit, not in the index. Unmodified Tracked, and identical to the last commit. Modified Tracked, changed since the last commit, not yet staged. Staged This exact version is marked to go into the next commit. Untracked ──git add──▶ Staged ──git commit──▶ Unmodified ▲ ...