Blog / git
Find when a coding agent changed a line
A value changed and you don't know which agent did it or why. Follow one line or function through history, find deleted code, and see past reformat commits.
On this page
- Blame shows the last change only
- Every change to a function
- Narrow it to one agent, or widen it to every branch
- Code that was deleted
- Skip reformat commits for good
- Code that moved to another file
- Ask the agent to do it
- Where Joxo fits
- Frequently asked questions
- How do I see the history of one line in git?
- How do I find who deleted a line of code?
- How do I make git blame ignore a formatting commit?
- Why does git blame show the wrong commit after code moved?
- How do I find a change that isn't on my branch?
- Try it with your team
Shipping used to cost nothing over 50 and now it's over 100. Somebody's agent changed it, maybe in a commit about something else, and a later reformat touched the same line. Git can follow that one line back through every change. We ran every command with git 2.43 on a scratch repository where each agent commits under its own name (see which coding agent made this commit).
Blame shows the last change only#
git blame -L 7,9 prices.js^ce18d8e (Sam Lee 2026-11-20 10:00:00 +0000 7) function shipping(sum) {
0d995081 (Claude (Sam) 2026-11-26 09:30:00 +0000 8) return sum >= 100 ? 0 : 5;
^ce18d8e (Sam Lee 2026-11-20 10:00:00 +0000 9) }-L 7,9 limits it to those lines. Line 8 points at Claude, but that commit only changed the indent. Add -w to skip whitespace changes:
git blame -w -L 7,9 prices.js^ce18d8e (Sam Lee 2026-11-20 10:00:00 +0000 7) function shipping(sum) {
425bc6f6 (Codex (Priya) 2026-11-24 14:12:00 +0000 8) return sum >= 100 ? 0 : 5;
^ce18d8e (Sam Lee 2026-11-20 10:00:00 +0000 9) }Now it names the commit that changed the number. A ^ before a hash marks the first commit, where the line began.
Every change to a function#
Blame gives one commit per line. To see each commit that touched a function, with its diff, use git log -L with the function's name:
git log -L :shipping:prices.js --format='%h %an %s'0d99508 Claude (Sam) Format with 4 spaces
diff --git a/prices.js b/prices.js
--- a/prices.js
+++ b/prices.js
@@ -7,3 +7,3 @@
function shipping(sum) {
- return sum >= 100 ? 0 : 5;
+ return sum >= 100 ? 0 : 5;
}
425bc6f Codex (Priya) Raise shipping threshold
diff --git a/prices.js b/prices.js
--- a/prices.js
+++ b/prices.js
@@ -7,3 +7,3 @@
function shipping(sum) {
- return sum > 50 ? 0 : 5;
+ return sum >= 100 ? 0 : 5;
}
ce18d8e Sam Lee Add totals
...Newest first, so the story reads top down: Codex moved the threshold from 50 to 100, then Claude reformatted. Line numbers work too, as -L 7,9:prices.js. Add -s for the list of commits without diffs. git show 425bc6f shows the whole commit, often with the reason in its message.
Narrow it to one agent, or widen it to every branch#
When each agent commits under its own name, --author keeps only its commits. It matches part of the name or email:
git log --author=Codex --format='%h %an %s'a274b7c Codex (Priya) Simplify total
425bc6f Codex (Priya) Raise shipping thresholdIt combines with everything on this page, so git log --author=Codex -L :shipping:prices.js shows only that agent's changes to the function.
git log searches the branch you're on. A change you can see in a running app but not in main may sit on a branch an agent never merged. Add --all to search every branch:
git log --all -G '>= 75' --format='%h %an %s %D'7798317 Claude (Sam) Try a lower threshold experiment%D names the branches pointing at the commit, here experiment. For a commit further down a branch, git branch --contains 7798317 lists every branch that has it.
Code that was deleted#
Blame can't show a line that's gone. git log -S finds commits that added or removed a piece of text:
git log -S 'let sum = 0' --format='%h %an %s'a274b7c Codex (Priya) Simplify total
ce18d8e Sam Lee Add totalsThe newest commit is where it went, the oldest where it came from. -S counts occurrences, so a commit that only moves the text within a file doesn't show up. To match any changed line containing a pattern, use -G with a regular expression: git log -G 'sum >=? ?[0-9]+'.
Skip reformat commits for good#
Agents often reformat whole files, and every line then blames that commit. List those commits in a file and tell git to see past them:
git rev-parse HEAD > .git-blame-ignore-revs
git config blame.ignoreRevsFile .git-blame-ignore-revs
git blame -L 8,8 prices.js425bc6f6 (Codex (Priya) 2026-11-24 14:12:00 +0000 8) return sum >= 100 ? 0 : 5;Here HEAD was the reformat commit; add one full hash per line for each one. Commit the file so the whole team gets it. Many hosts read .git-blame-ignore-revs in their blame view too. Each person runs the git config line once in their clone.
Code that moved to another file#
An agent split a function into its own file, and blame now says the split commit wrote every line:
git blame -s lib/total.jsdb8e9e53 1) function total(items) {
db8e9e53 2) for (const i of items) sum += i.price;-C -C looks for the lines in other files, including the ones the commit that created this file came from, and follows them back:
git blame -s -C -C lib/total.js^ce18d8e prices.js 1) function total(items) {
^ce18d8e prices.js 2) for (const i of items) sum += i.price;The file name column shows where each line really came from. -s hides names and dates to keep it short.
Ask the agent to do it#
These commands are slow to type and fast for an agent to run. Ask: "Use git log -L and git log -S to find which commit changed the shipping threshold, who made it and what its message says. Don't change anything." You get the answer with the commit to check yourself. If the agent also has access to your host's command line tool, it can find the pull request that brought the commit in, where the discussion often explains the change better than the commit message does.
Where Joxo fits#
A commit tells you which agent changed a line; it rarely tells you who asked for it. Joxo keeps each agent's task on a shared board under its person's name, with the branch and pull request, so a commit leads you back to the request behind it. Setup is one line pasted into your agent.
Frequently asked questions#
How do I see the history of one line in git?#
Run git log -L <start>,<end>:<file>, or git log -L :<function>:<file> for a whole function. It lists every commit that changed those lines, with the diff.
How do I find who deleted a line of code?#
Run git log -S '<text>' -- <file>. The newest commit listed is the one that removed it; git show <hash> shows the change.
How do I make git blame ignore a formatting commit?#
Put its full hash in a .git-blame-ignore-revs file and run git config blame.ignoreRevsFile .git-blame-ignore-revs. For one-off use, git blame -w ignores whitespace-only changes.
Why does git blame show the wrong commit after code moved?#
Blame credits the commit that put the lines in this file. Add -C -C and it follows lines copied or moved from other files back to where they started.
How do I find a change that isn't on my branch?#
Add --all to git log, as in git log --all -G '<pattern>'. It searches every branch, including ones an agent made and never merged, and %D in the format names the branch each commit is on.