AI Learning Hub › Learn AI › Self-Paced Courses › GitHub Without the Jargon › When AI Works in the Repository
Module 9 ยท Intermediate
When AI Works in the Repository
The working tree as separate from history: find an uncommitted AI-made edit with status and diff, and tell a summary from repository evidence.
By the end
- Explain what it means for an AI coding tool to work in a local repository
- Recognize the working tree as separate from commit history
- Identify an uncommitted AI-made change
- Use
git statusto see which files changed - Use
git diffto inspect what changed - Distinguish an AI summary from repository evidence
- Explain why a local AI edit does not automatically appear on GitHub
- Explain why permission to edit locally is different from permission to publish remotely
If an AI changes a file, what exactly changed?
Module 8 separated four events that people routinely blur together: edit, save, commit, push. That model is about to do more work than you might expect. AI does not create a new category of repository state. Its changes still have to live somewhere.
A coding agent may read files, edit files, run commands, create commits, or interact with remotes — depending on what tools it has, what permissions it holds, what instructions it was given, and what environment it is running in. Those are four different questions, and the answers are not the same.
In the controlled run described below, exactly one of those was permitted: reading the project file, and making one local edit to it. Nothing else.
Three words to learn
Coding agent
An AI system that can use tools to inspect or change a project while pursuing a task.
Working tree
The checked-out project files in a local Git repository as they exist right now.
Uncommitted change
A change in the local project files that has not yet been recorded in a commit.
Not every AI assistant is a coding agent. A chat window that suggests text you paste in yourself is not changing your project — you are. The word agent here means the system has tools and can act on files directly.
GitHub’s glossary does not define working tree on its own, though it uses the phrase: a working tree “is clean if it corresponds to the revision referenced by the current HEAD.” The definition above is this course’s plain-language version of the same idea.
Know the state before the AI starts
The run below happened on a branch created for it, in the disposable practice repository. The baseline, recorded before anything else:
- Branch
ai-practice, created frommaingit status --short- No output at all — nothing modified
- Latest commit
Update practice status, the same onemainwas on- Remote branch
- None. This branch has no upstream.
- On GitHub
- Three branches, and
ai-practiceis not one of them.
If you do not know the before state, it is harder to tell what the AI actually changed.
Knowing the before state does not make the after state correct. It only makes the difference visible. That is a smaller claim than it sounds, and still worth the thirty seconds it costs.
The branch exists on this computer. GitHub does not know about it.
Worth pausing on, because it is Module 8’s lesson arriving in a new place. Creating a branch locally sends nothing anywhere. GitHub’s branch list was checked before the AI ran and showed the same three branches it had all along.
Git does not phone home when you create a branch. A local branch is a local fact until you push it.
Give the agent a small target
The agent was given one bounded task. It is reproduced in full, because the boundaries are the interesting part:
Work only in this disposable
practice repository.
Read README.md before editing it.
Add one new section at the end
titled:
## AI practice
Under that heading, write exactly
two short bullet points:
- one explaining that an AI coding
tool can change local files;
- one reminding the reader to
inspect changes before committing.
Keep all existing README content
unchanged.
Do not create, rename, or delete
any file.
Do not modify any file except
README.md.
Do not run git add, git commit,
git push, git reset, git checkout,
git switch, git merge, git rebase,
or git stash.
Do not use GitHub, the GitHub API,
or a browser.
Stop after editing README.md and
report which file you changed.
Lines are wrapped here to fit a narrow screen; the task was given as ordinary prose.
Notice the shape of it. The what is specified tightly — one file, one section, exactly two bullets. The wording of those bullets is left entirely open. That is a real choice handed to the agent inside a narrow frame, which is a reasonable way to ask for help without asking for surprises.
The agent can report what it did. Git can show what changed.
The agent finished and reported, accurately paraphrased: that it read the existing README first, appended an ## AI practice section with exactly two bullets, left all prior content untouched, created or deleted nothing, and ran no git commands.
That is a clear, specific, confident report. It is also, on its own, a claim. So here is what the repository said, independently:
$ git status --short
M README.md
One line. One file, modified. No new file, no deleted file, no rename, nothing staged, no untracked leftovers.
$ git diff --stat
README.md | 5 +++++
1 file changed, 5 insertions(+)
The agent's summary is a report; the diff is evidence of the file change.
Both turned out to be true here. That is the ordinary case and it is not the point. The point is that they are two different kinds of thing, and only one of them is produced by the repository itself.
Read what changed, not just what the agent says changed
The diff showed five added lines and nothing removed: a blank line, the heading, another blank line, and two bullets. These are the agent’s own words, reproduced exactly:
“An AI coding tool can edit the files in your local copy of a repository.”
“Review every change it makes before you commit.”
Reading the diff rather than the summary lets you check four things the summary cannot establish on its own:
- Scope — did anything else change?
- Wording — is what it wrote actually what you wanted?
- Deletion — did something quietly disappear? The
−0answers that. - Neighbors — did lines near the edit shift for no reason?
This is Markdown, so the review burden is small. Four lines of plain English can be read in seconds. Reading a diff is not the same as testing code, and for anything that runs rather than reads, it is the beginning of review rather than the end of it.
Start with the shape of the change
The two commands do different jobs, and the order matters.
git status answers which files: what changed, whether each is new, modified, or deleted, and whether anything is staged. GitHub’s documentation puts it plainly — it “shows the status of changes as untracked, modified, or staged.”
git diff answers what inside them. Status tells you where to look, and diff tells you what to look at.
On a one-file change the distinction feels academic. On an agent run that touched nineteen files it is the difference between a review and a shrug.
The file changed. History did not.
Before the agent ran, the latest commit was Update practice status. After the agent ran, the latest commit was Update practice status.
Nothing was recorded. The README is modified in the working tree — the files as they sit on disk right now — and the repository’s history is exactly as it was.
Editing changes the working tree, and committing changes repository history.
That is Module 3’s sentence, unchanged. An AI making the edit leaves that sequence intact; it only means somebody else typed.
File change, commit, push
File change
Exists now in the local working tree.
Observed: yes.
Commit
Would record the change in local repository history.
Observed: not yet.
Push
Would publish local commits to a remote.
Observed: not performed.
AI-made does not change the sequence. File → commit → push are still separate states.
GitHub still does not know about any of this
Checked read-only after the edit, GitHub had: the same three branches, at the same commits, with no ai-practice anywhere, and a main README containing no AI practice section. The AI changed a file on this computer, and GitHub did not change. A local branch can contain AI work that GitHub has never seen.
This is the single most useful thing in the module. An agent working in your checkout is working in your checkout. Whether anything reaches a place other people can see is a separate question with a separate answer.
What if the agent had committed?
Suppose it had been allowed to create a local commit. Then the local repository’s history would have changed — and GitHub still would not have, until a push or some other remote action occurred. Local history and published history are separate states too.
Nothing was committed in this run. Module 10 decides what happens to the change.
What was the AI actually allowed to do?
In this run the agent was permitted to read the README and modify it locally. It was told not to commit, switch branches, merge, push, or use GitHub.
Separate those two sentences from a third one: what the tool is capable of. Anthropic’s own documentation describes Claude Code as a tool that “reads your codebase, edits files, runs commands, and integrates with your development tools,” and says it “works directly with git — it stages changes, writes commit messages, creates branches, and opens pull requests.”
So the capability plainly exists. It simply was not used, because the task did not ask for it. Local access is not the same thing as permission to publish.
An instruction is not a technical control
This distinction is easy to lose and worth holding onto.
The task said do not push. The agent did not push. It would be a mistake to conclude that pushing was impossible.
The instruction defined what the agent was permitted to do in this exercise. It does not prove the environment was technically incapable of doing more.
Two different mechanisms can produce the same outcome:
Instruction boundary
The task says not to. Compliance is behavior.
Technical control
The environment does not permit it. Compliance is enforced.
In this run, the boundary was the instruction. No permission prompt appeared and nothing was blocked, because nothing outside the task was attempted. That is an observation about one run, not a statement about how any tool’s permission system behaves.
Observed with Claude Code
Observed with Claude Code
Verified: 21 September 2026. Version: 2.1.274.
The run happened in the disposable local practice clone, on the local-only ai-practice branch, with the bounded task above. What was observable: the agent read README.md before editing it, used three tool actions in total, modified only README.md, attempted nothing outside the task, ran no git commands, and reported which file it changed.
No permission prompt appeared during this run, and nothing was blocked. The model behind the run was not reliably visible in the interface, so it is not recorded. This is one product, one task, one date. Other coding tools behave differently, and so might this one on a different task — nothing here should be read as a general claim about how coding agents behave.
Which state changed?
The AI edited the README on local ai-practice. No commit. No push.
A. Working tree
B. Local commit history
C. GitHub branch list
D. Remote README
One possible answer
A only.
B did not: the latest commit was identical before and after. C did not: GitHub had three branches before and three after, and ai-practice was never among them. D did not: on GitHub, the main README still had no AI practice section.
Four states, one change. Being able to say which one is most of what this module is for.
The agent says “I only changed README.” What should you check?
A. Trust the summary.
B. git status and the diff.
C. Check whether GitHub's homepage
looks normal.
D. Commit immediately.
One possible answer
B.
The agent’s summary is useful context and was accurate in this run. It is still a description produced by the thing being described. git status and the diff are produced by the repository, and they answer a narrower question precisely: what does Git see as changed?
A skips the only independent evidence available. C looks in the wrong place entirely — nothing local had reached GitHub. D records the change before anyone has read it, which is the habit Module 6 exists to discourage.
Allowed versus possible
An agent has tools capable of running shell commands. The task says: do not commit or push.
Does that prove commit and push were technically impossible?
One possible answer
No. It tells you the action was outside the granted task scope. Whether it was also technically prevented depends on the environment’s actual permissions and controls, which is a separate thing to check.
Permission is about what should happen. Capability is about what can happen.
Both matter, and conflating them leads to the wrong kind of confidence — trusting an instruction where you needed a control, or adding a control where an instruction would have done.
Where is the AI work?
Local branch ai-practice; working tree modified; no local commit; no remote branch.
If another person had opened GitHub at this point in the exercise, would they have seen this AI-generated README section?
One possible answer
No.
Nothing had been committed, nothing had been pushed, and the branch existed only on one computer. There was no path by which the change could have reached GitHub, and we confirmed it had not.
Which raises the question Module 10 opens with: the change exists, nobody else can see it, and somebody now has to decide what it deserves.
What to notice
When an AI coding tool says it changed a project, there are four questions and four places to get answers:
Which files changed?
git status
What changed inside them?
git diff
Was it committed?
The history
Was it published?
The remote, on GitHub
The agent can act inside the repository, and Git still gives you observable states to inspect.
Before you continue
You are ready for Module 10 if you can:
- explain what a coding agent did in the local repository;
- explain what the working tree is;
- explain what an uncommitted change is;
- distinguish a file edit from a commit;
- distinguish a local commit from a push;
- use status to identify changed files;
- use diff to inspect the actual change;
- distinguish an agent’s summary from repository evidence;
- explain why the AI-created local branch is not visible on GitHub;
- distinguish an instruction boundary from technical prevention; and
- explain why local file authority does not imply remote publishing authority.