Blog / git
See everything a coding agent changed while you were away
Tag the commit before you leave, then three git commands show every commit, every edited file and every new file, even on a branch the agent switched to.
On this page
- Before you leave: one tag
- When you come back: three commands
- Did it switch branches?
- I forgot to tag
- Make it one command
- What to read first
- Undo the parts you don't want
- When more than one agent is working
- Frequently asked questions
- How do I see what Claude Code or Codex changed in my repo?
- Why doesn't git diff show the files the agent created?
- How do I see commits the agent made on another branch?
- Can I see what changed in the last hour without a tag?
- Try it with your team
You leave an agent on a task and come back an hour later. The summary says "done", and maybe it is. Before you trust it, you want the full picture: what it committed, what it changed and didn't commit, what new files it made, and whether it moved you to another branch along the way.
git status alone misses most of that. Here is the short routine we use, with every command run on git 2.43.
Before you leave: one tag#
git tag -f agent-startThat marks where things stood. -f moves the tag if it's still there from last time. It stays on your machine unless you push tags, and it costs nothing.
When you come back: three commands#
We made a small repository, tagged it, and then did what agents often do: committed on main, switched to a new branch, committed again, left an edit uncommitted and created a new file.
What did it commit?
git log --oneline --all agent-start..0f24d24 Tidy greeting
353f908 Add sub--all matters. One of those commits is on feature/, a branch the agent made. Without --all you'd only see the branch you're on.
What changed, committed or not?
git diff --stat agent-start app.py | 2 +-
calc.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)This compares the tag with the files on disk right now, so it includes commits and uncommitted edits together. Drop --stat to read the lines themselves.
What's new and not tracked?
git status --short M calc.py
?? test_calc.pygit diff never shows untracked files, so test_ only shows up here. New files are where agents leave scratch scripts, copied secrets and stray outputs, so read this list every time.
Did it switch branches?#
git reflog --date=relative | head0f24d24 HEAD@{3 minutes ago}: commit: Tidy greeting
353f908 HEAD@{3 minutes ago}: checkout: moving from main to feature/tidy
353f908 HEAD@{3 minutes ago}: commit: Add sub
743c508 HEAD@{3 minutes ago}: commit (initial): initThe reflog is your own diary of where HEAD went. A checkout: moving from main to ... line you didn't type means the agent moved you. The diff above was against the branch you are on now, so if you were moved, run the same commands after git switch main too.
I forgot to tag#
Git can still answer by time:
git log --all --since="2 hours ago" --oneline
git diff --stat 'HEAD@{2.hours.ago}'The second form uses the reflog, so it follows where your HEAD was two hours ago on this machine. If the repository is younger than that, git warns and uses the oldest entry it has. Tag next time: it's exact, and it doesn't depend on clocks.
Make it one command#
git config --global alias.since-agent '!git log --oneline --all agent-start.. && git diff --stat agent-start && git status --short'
git since-agentWhat to read first#
Not every change deserves the same attention. We read in this order:
- New files. Anything under
??that you didn't expect. Scratch scripts, logs, a copied.env, a second config file that shadows the first. - Files outside the task. If you asked for a fix in
calc.pyand the diff touches the build config, the lockfile or the CI settings, find out why before anything else. - Deleted or emptied tests.
git diff --statshows a large minus count; read those hunks line by line. A test that was removed is the cheapest way to make a suite pass. - The change you asked for. Last, because by now you know whether the rest can be trusted.
Undo the parts you don't want#
Each kind of change has its own undo, and none of them touches the rest:
git restore calc.py # drop an uncommitted edit to one file
git clean -n # list untracked files that would be removed
git clean -f test_calc.py # remove one of them
git revert --no-edit 353f908 # undo one commit with a new commit
git branch -D feature/tidy # delete a branch you don't wantRun git clean -n before git clean -f: the first only lists, the second deletes, and untracked files aren't in git, so they can't be brought back from it. Prefer git revert over git reset on anything you've shared; it adds a commit instead of rewriting the ones other people may already have.
When more than one agent is working#
The routine above tells you what changed in one folder. With several agents, often for several people, the harder question is whose change it was and whether anyone else was touching the same files. Give each agent its own git name and its own worktree, and read our checklist for reviewing PRs from several agents. Joxo shows what each agent on a project is doing as it works, so the catch-up is a glance, not an investigation.
Frequently asked questions#
How do I see what Claude Code or Codex changed in my repo?#
Tag the current commit before the session (git tag -f agent-start). Afterwards, git log --oneline --all agent-start.. lists its commits, git diff --stat agent-start shows every changed file including uncommitted edits, and git status --short lists new untracked files.
Why doesn't git diff show the files the agent created?#
git diff only compares tracked files. New files stay untracked until someone runs git add, so they only appear in git status (as ??) or in git ls-files --others --exclude-standard.
How do I see commits the agent made on another branch?#
Add --all to git log. It lists commits on every branch, including ones the agent created. git reflog shows whether it switched your checkout to another branch.
Can I see what changed in the last hour without a tag?#
Yes: git log --all --since="1 hour ago" --oneline lists recent commits, and git diff --stat 'HEAD@{1.hour.ago}' compares with where HEAD was an hour ago on this machine. A tag is more reliable because it doesn't depend on the reflog or clocks.