Stage 3 - Tracking Changes Effectively
At the end of Stage 2, task-service has three commits. Now imagine you edit task-service.js to prevent duplicate tasks and at the same time fix wording in README. Before creating the next commit, you must inspect what exactly changed.

Why seeing changes is the core discipline
Without inspected diffs, commit history becomes a blur. You lose the difference between “I touched this block by accident” and “this change supports the story we planned.”
In task-service, make three changes:
- update task validation in
task-service.js; - append a usage example to
README.md; - create
notes.txtwith a temporary thought.
Now run:
git status
It will show both README.md and task-service.js as modified. notes.txt might be untracked.
Compare before commit, not after
git diff answers: what has changed in the working directory but is not staged yet?
git diff
git diff --staged answers: what will the next commit contain?
git add task-service.js
git diff --staged
This split is crucial when a learner wants to avoid mixing unrelated concerns, for example “fix duplicates” and “rewrite docs tone”. Keep those separate if the intent differs.
Correcting with intent, not panic
If you made a wrong local edit in notes.txt, you can discard it:
git restore notes.txt
If you staged task-service.js too early and need more edits before commit:
git restore --staged task-service.js
Now the edit returns to working state and remains recoverable. You did not lose work, just moved it back one step.
Renaming and removing in real projects
Sometimes requirements change and a file no longer belongs to the project. Use:
git rm notes.txt
git commit -m "docs: remove obsolete scratch note"
If you just want to move a file from root into a docs folder, first create the docs folder in Finder, File Explorer, or your IDE. Then run:
git mv README.md docs/README.md
git add docs/README.md
git commit -m "docs: move main README to docs"
git mv is clear about intent and usually easier to review than moving by file manager first.
| Situation | Helpful command | Decision it enables |
|---|---|---|
| Review local edits | git diff |
Commit only what is correct and complete |
| Review staged edits | git diff --staged |
Verify the exact commit payload |
| Cancel accidental local edit | git restore |
Remove noise before commit |
| Move or remove file | git mv / git rm |
Keep history coherent |
Glossary
- version control
- A system for tracking project changes over time so developers can inspect, compare, and restore previous states.
- repository
- A storage area for a project, its files, history, and related metadata.
- commit
- A saved Git history point that records a related set of changes, the author, and the reason for the change.
- branch
- An independent line of work where changes can be developed without immediately affecting another line.
- merge
- The operation that combines changes from one branch or source into another.
- conflict
- A situation where a tool cannot automatically combine changes because different edits affect the same part.
- staging area
- The Git area where selected changes are prepared before they become part of the next commit.
- working tree
- The current files and folders checked out in your project directory, including uncommitted edits.
- diff
- A comparison that shows exactly which lines or values were added, removed, or changed.
- remote
- A named connection to a repository stored somewhere else, usually on a server such as GitHub.
- clone
- The operation that copies an existing repository from a remote location to your local machine.
- push
- The operation that sends local commits or changes to a remote repository.
- pull
- The operation that downloads changes from a remote repository and integrates them locally.
- pull request
- A review request that proposes merging one branch into another and gives teammates a place to discuss changes.
- fork
- A personal copy of another repository, usually used to propose changes without direct write access.
- review
- The engineering practice of checking changes for correctness, clarity, risks, and maintainability.
- rollback
- A deliberate return to an earlier safe state after a mistake, regression, or unwanted change.
- rebase
- A Git operation that moves commits to a new base commit, often used to make history more linear.
- tag
- A named marker pointing to a specific version, commit, image, or release artifact.