Your first commit
Save a snapshot
⏱ Est. ~4 min
01 · Read
A commit permanently saves your staged changes as a snapshot. Once committed, that version is preserved forever in git's history. Every commit gets a unique ID and the message you wrote describing what changed.
💡 Picture thisMaking a commit is like taking a photo of your desk. The photo captures exactly what the desk looked like at that moment. You write a small caption on the back describing the moment. Later, you can flip through and see your desk at any point in time.
Key points
- git commit -m "message" saves staged changes with a description
- Every commit gets a unique hash (ID)
- Commits are permanent — you can return to any previous commit anytime
02 · Terminal exercise
You have a project with two files. Let's initialize git and save your first snapshot.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Stage all the files, ready to be committed.
(This section is interactive — please enable JavaScript.)
04 · Terminal exercise
A commit is a snapshot of your project saved. Every commit needs a message describing what you did. The -m flag lets you put the message right in the command.
(This section is interactive — please enable JavaScript.)
05 · Fill in the blank
The core git workflow is: change stuff, stage with git add, then save a snapshot with git _____ -m.
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.