When you unzipped the Generic Grocery Co. site, it came with three deals files. The import in src/deals-page.js told you which one was live, and comparing the copies showed what differed, but no file recorded who changed what, when, or why. Now the same project has a history, with every change you made this week recorded as a commit that explains what you changed and why.
In this summary, you’ll look back at how you got there and at the habits you built along the way. You’ll also see which command answers which question, so you can come back to this page whenever you’re unsure. Start with what your repository holds now.
Look Back at Your History
Your history began in a throwaway practice folder, where a mistake couldn’t cost anything. There, you saw that git add copies a file into the staging area as it is at that moment, and that a commit takes only what you staged. An edit you made after git add stayed out of the commit until you added the file again.
Then you looked inside a commit. A commit is a snapshot of every tracked file, labeled with an author, a date, and a message. Every commit after the first also records the hash of its parent, the commit before it, while the first commit in a repository has no parent. Git works out what changed by comparing two snapshots, so a commit doesn’t store a list of changed lines.
In the same folder, you committed a notes file and only then added it to .gitignore. Git kept tracking it because .gitignore applies only to files that aren’t tracked yet. You stopped tracking it with git rm --cached, and you saw that the earlier commits still hold their copy.