AI Learning Hub › Learn AI › Self-Paced Courses › VS Code: Files, Changes, and AI Agents › See What Changed
Module 6 · Beginner to intermediate
See What Changed
Three places the editor reports a change, and how to read a diff line by line — including the changes a finished page looks perfectly fine about.
By the end
- Find a file’s change state in the Explorer, the editor gutter and the Source Control view
- Say what the letters
MandUmean - Read a diff line by line and name what was added, removed and modified
- Explain why a correct-looking result does not establish a correct change
- Find a change nobody asked for
This is the module the rest of the course exists for. Everything before it was orientation; everything after it is what you do once you can read a change.
The skill is narrow and transfers everywhere. Given a file that is different from how it was, you want to be able to say precisely what is different — not approximately, not from memory, and not from somebody’s summary of their own work.
The editor tells you three times
Before you open anything called a diff, VS Code has already reported that something changed, in three places at once.
Beside two of the file names there is a letter. M means modified — Git was already tracking this file and its contents have changed. U means untracked — Git can see the file but it is not part of the recorded history, usually because it is new.
The icon in the Activity Bar carries a count of how many files are in one of those states, and the status strip at the bottom shows the branch name with an asterisk after it, which is Git’s way of saying there is uncommitted work here.
The letters matter more than the colors. VS Code tints these as well, and the tinting is genuinely useful, but the letters are what you should read and what this course will always name. Color is a second channel, not the message.
A few Git words, kept short
You will meet five terms and need only enough of each to read the interface. GitHub Without the Jargon teaches the model properly; this is the vocabulary needed to make sense of what is on screen.
- Modified
- A file Git is tracking has changed since the last recorded version.
- Untracked
- Git can see the file but has never recorded it. New files start here.
- Staged
- A change you have selected to go into the next commit. Editing a file does not stage it.
- Commit
- A recorded snapshot of the changes you staged, with a message saying what they were.
- Branch
- A line of work. The name in the status strip tells you which one you are on.
The Source Control view
Open it with View: Show Source Control from the Command Palette. This is where every changed file is listed in one place.
Microsoft’s documentation describes the split this view can show: select a file under Changes “to review unstaged edits, or in Staged Changes to review what the next commit will contain.” In the screenshot there is only one group, because nothing has been staged. Module 7 is about that second group and the decision it represents.
Reading a diff
A diff is a view of one file in two states at once: how it was, and how it is now. VS Code marks removed lines with a minus and added lines with a plus, and numbers them in two columns so you can see where each version sat.
Here is the one that matters. Someone was asked to correct a room number on the event page from 180 to 290. Here is what they actually did.
Work through it slowly, because the pattern repeats everywhere.
The first removed line and the first added line are the same sentence with one difference: Room 180 became Room 290. VS Code highlights the digits within the line, so you can see that the rest of the sentence is untouched. That is the change that was requested, and it is correct.
The second removed line is the paragraph about the evening of oral argument, ending with its closing </p> tag. The second and third added lines are the same sentence — but the closing tag has moved onto a line of its own. Nothing was added to the page and nothing was deleted from it. A tag simply relocated.
This is why a modified line shows up as a removal plus an addition rather than as an edit in place. A diff does not describe intentions; it reports which lines are no longer there and which lines are new.
What the finished page does not tell you
Open the page in a browser after that change and it looks completely correct. The room number is right, the paragraph reads normally, the layout is unchanged. In HTML, a closing tag on its own line renders identically.
So the result passes inspection and the change still contains something nobody asked for. A working page tells you what the output looks like. A diff tells you what was altered to produce it. Those answer different questions, and only the second one tells you whether the work matches the request.
Whether that stray tag matters is a judgment call, and reasonable people land differently. It may be harmless tidying. It may be the visible edge of an agent rewriting more of the file than you expected. The point of this module is not that the change is wrong — it is that you got to decide, because you read the diff.
Why this gets harder with an agent
When you make a change yourself, you have a memory of it. You know you touched one line, because you were there. That memory is doing more work than people realize, and an agent’s edit gives you none of it.
What you get instead is a summary: I updated the room number. That is usually true and almost never complete. It is a claim about the diff, and the diff is sitting right there.
Exercise: read a change you did not make
If you did the Module 4 exercise, your practice project already has a modified file. If not, open index.html, change the room number to 290, and save.
- Open View: Show Source Control. How many files are listed, and what letter does each carry?
- Open
index.htmlin the editor and look at the left margin beside the line numbers. The changed lines are marked there too. - Open the diff for that file by selecting it in the Source Control list.
- Write down, in your own words, one line per change: what was removed, what was added, and which parts of each line differ.
- Open
index.htmlin a browser. Does the page look wrong in any way?
How to be sure you are looking at a diff
The tab tells you. A diff tab is labeled with the file name followed by (Working Tree) — index.html (Working Tree) — and the editor shows two columns of line numbers. A plain file tab carries just the name and one column.
If you would rather use a command than the list, open the Command Palette and run Git: Open Changes with the file open. One thing to watch: the first match offered is usually Git: Open All Changes, which is a different command. The one you want is the entry named git.openChange, a line or two below it.
The last step is the one to sit with. The page was fine. The change still deserved reading. That gap is the reason this module is the longest one in the course, and it is the entire premise of the capstone.