Stage your changes
Pick what to save
⏱ Est. ~5 min
01 · Read
git doesn't automatically save every change for you. You have to pick which changes go into the next save point. This picking step is called staging, and the tool is git add.
💡 Picture thisStaging is like packing a box to ship. There's a pile of stuff on the desk, but you don't have to ship it all at once. You pick which items go into the box (git add), then seal and label the box (git commit). What you didn't pick stays on the desk, waiting for the next shipment.
Key points
- git add filename stages a single file for the next commit
- git add . stages everything in the current directory
- Staging gives you precise control over what goes into each save point
02 · Terminal exercise
This project has two files, but git isn't tracking anything yet. Initialize git in this folder first.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Staging is how you pick which changes go into the next save point. Think of it as putting items into a box before you ship it.
(This section is interactive — please enable JavaScript.)
04 · Terminal exercise
Let's check the status to see the difference between staged and unstaged files.
(This section is interactive — please enable JavaScript.)
05 · Terminal exercise
You can also stage everything at once instead of adding one by one.
(This section is interactive — please enable JavaScript.)
06 · Fill in the blank
To stage a specific file, you type git ___ filename.
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.