Making changes
The edit-add-commit cycle
⏱ Est. ~7 min
01 · Read
Real development is a cycle: you edit files, stage them with git add, save them with git commit. The edit → add → commit rhythm is the core of how you work with git every day.
💡 Picture thisThink of it like keeping a daily journal: you write your thoughts during the day (edit files), pick which pages to keep (stage with git add), then bind them into the journal (commit). Do it again tomorrow, and the journal grows page by page.
Key points
- The core git workflow: edit files → git add → git commit
- You can make many changes before staging and committing
- Each commit should ideally match one logical change or task
02 · Terminal exercise
Let's practice the full git workflow: init, commit, change, commit again.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Stage all the files.
(This section is interactive — please enable JavaScript.)
04 · Fill in the blank
The three-step git workflow is: edit files, ___, then commit.
05 · Terminal exercise
Make your first commit — saving the project's current state as a snapshot.
(This section is interactive — please enable JavaScript.)
06 · Terminal exercise
Now make a change to your file. Add a welcome message to the end of the HTML file.
(This section is interactive — please enable JavaScript.)
07 · Terminal exercise
Now save your changes. Stage the modified file, then commit it with a descriptive message.
(This section is interactive — please enable JavaScript.)
08 · Quiz
You changed three files but only want to commit two of them. How?
- Run git commit, and git will ask which files to include
- Run git add ., then manually remove the third file from the commit
- Only run git add on the two files you want, then commit
- Modified files must all be committed at once
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.