Chapter 4
Inspect, undo, ignore
Updated July 31, 2026
You already know how to put files in the index and make a commit. Now you need three more things: to see what exactly changed since the last snapshot, to roll back what you did by mistake, and to tell git which files it should not notice at all.
What changed: git diff
git status answers the question "which files were touched". git diff answers "what inside them was touched, line by line".
Edit one line in report.txt and add another line at the end. Then ask git:
$ git diff
diff --git a/report.txt b/report.txt
index 98679e4..3394999 100644
--- a/report.txt
+++ b/report.txt
@@ -1,4 +1,5 @@
Q3 report
-Sales grew.
+Sales grew by 12%.
We hired two people.
+Next quarter's budget is approved.The first
Locked
The rest of this chapter is part of a paid course
You are reading the open part. Buy the course to read the whole chapter.