Chapter 2 of 14All chapters
Chapter 2 of 14
The three places
Working tree, staging area, repository.
How a change travels
A change starts in the working tree, moves to the staging area with git add, and becomes history with git commit. Nothing leaves your machine until you push.
- git status shows what sits in each place right now.
- git diff shows unstaged changes, and git diff --staged shows what a commit would contain.
Why staging exists
The staging area lets you commit some of your work and not the rest. That is how one messy afternoon becomes three commits that each make sense on their own.