Blog / git
Which coding agent made this commit? Give each its own git name
Every commit from your agents carries your name. Give Claude Code, Codex and each worktree its own git author, then find their work with git log and blame.
On this page
- What git uses as the author
- Option 1: one environment variable per agent
- Option 2: one git name per worktree
- Option 3: a trailer in the message
- Find who wrote what
- On a team
- What it doesn't tell you
- Where Joxo fits
- Frequently asked questions
- How do I see which commits Claude Code made?
- Can I set a different git user per worktree?
- Will commits with a +agent email still link to my GitHub account?
- Why does git shortlog hang?
- Try it with your team
You run Claude Code in one terminal, Codex in another, and you also commit by hand. A week later git log shows a hundred commits, every one of them signed with your name. A bug turns up and you want to know: did I write this, or did an agent? And which one?
Git can't tell you, because every commit uses the same user.name and user.email from your git config. The agents don't sign as themselves unless you tell git to. The fix is to give each agent its own author name. It takes one line per agent, and then git log, git blame and git shortlog answer the question for you.
We tested everything below with git 2.43 and Claude Code 2.1.318 in a scratch repo.
What git uses as the author#
Every commit stores an author and a committer. Git takes them, in order, from:
- The environment variables
GIT_,AUTHOR_ NAME GIT_(andAUTHOR_ EMAIL GIT_,COMMITTER_ NAME GIT_).COMMITTER_ EMAIL - Your git config: the worktree, then the repo, then your global
~/.gitconfig.
Agents run git as a normal program, started from the shell you launched them in. So anything you set in that shell, or in the folder the agent works in, reaches every commit the agent makes. You don't need a setting inside the agent itself.
Option 1: one environment variable per agent#
Start the agent with its own author name:
GIT_AUTHOR_NAME="Claude (Sam)" GIT_AUTHOR_EMAIL="sam+claude@example.com" claudeWe asked Claude Code, started like that, to commit a change. Its commit was signed:
Claude (Sam) <sam+claude@example.com>The committer stays you, which is right: you are the person who let it happen. Only the author changes.
Typing that every time gets old, so put a small function in your ~/.bashrc or ~/.zshrc:
# usage: as_agent <agent command> [args...] e.g. as_agent claude or as_agent codex
as_agent() {
agent="${1}"; me=$(git config user.name); mail=$(git config user.email)
GIT_AUTHOR_NAME="$agent ($me)" GIT_AUTHOR_EMAIL="${mail%@*}+$agent@${mail#*@}" "$@"
}Now as_ or as_ starts the agent, and its commits are signed claude (Sam Lee) or codex (Sam Lee), with an email like sam+codex@example.com. The +agent part keeps the address yours: most mail providers deliver it to the same inbox, and your git host still links the commits to your account if that address is on it.
It works for any agent you start from a shell, because the agent never sees the trick: git just finds a name in its environment.
Option 2: one git name per worktree#
If you give each agent its own git worktree (a good idea anyway, so they don't edit the same files), you can set the name on the worktree instead. Turn on per-worktree config once:
git config extensions.worktreeConfig trueThen, inside the agent's worktree:
git worktree add ../shop-claude -b claude-work
cd ../shop-claude
git config --worktree user.name "Claude (Sam)"
git config --worktree user.email "sam+claude@example.com"In our test, a commit made in shop-claude was signed Claude (Sam), and the next commit in the main folder was still signed Sam Lee. Nothing to remember at launch: whatever runs in that folder signs as the agent.
The catch: it's tied to the folder, not the agent. If you later run a different agent in the same worktree, it signs with the same name. Use the environment variable when one folder is shared by several agents.
Option 3: a trailer in the message#
Git also understands key-value lines at the end of a commit message, called trailers. They help when you commit an agent's work yourself, for example after reviewing what Codex left in your folder:
git commit -am "add currency" --trailer "Agent: codex"List them next to each commit:
git log --format='%h %an %(trailers:key=Agent,valueonly,separator=%x2C) %s'104a43a Sam Lee codex add currency
48de038 Claude (Sam) add discount
80deed8 Codex (Sam) add tax
54ee755 Sam Lee add pricesTrailers only work if every agent adds them every time, which is the weak point. The author name is set outside the agent and can't be forgotten. Use trailers for extra detail, not as the only record.
Claude Code adds a trailer of its own by default: in our test its commit ended with a Co-Authored-By: Claude … line. If you keep that on, you can find those commits with:
git log --grep='Co-Authored-By: Claude' --onelineIt tells you Claude was involved, but not whose Claude, which is why the author name matters on a team.
Find who wrote what#
With names in place, the usual git commands answer the question.
Who made each commit:
git log --format='%h %<(14)%an %s'104a43a Sam Lee add currency
48de038 Claude (Sam) add discount
80deed8 Codex (Sam) add tax
54ee755 Sam Lee add pricesWho wrote each line of a file:
git blame prices.txt^54ee755 (Sam Lee 2026-11-05 09:20:25 +0000 1) price = 10
80deed84 (Codex (Sam) 2026-11-05 09:20:25 +0000 2) tax = 0.2
48de0387 (Claude (Sam) 2026-11-05 09:20:28 +0000 3) discount = 0
104a43af (Sam Lee 2026-11-05 09:20:35 +0000 4) currency = EUROnly one agent's commits:
git log --author='Codex' --oneline80deed8 add taxA count per author:
git shortlog -sne HEAD 2 Sam Lee <sam@example.com>
1 Claude (Sam) <sam+claude@example.com>
1 Codex (Sam) <sam+codex@example.com>Note the HEAD at the end. Without it, git shortlog run from a script or by an agent waits for input on stdin and hangs. We hit that ourselves while testing.
On a team#
When four people each run two agents, put the person's name in the agent's name, as above: Claude (Sam), Codex (Priya). Then a line in git blame tells you both who to ask and which tool wrote it.
Add one line to your setup notes so everyone does the same:
Start agents with as_agent <name> so their commits are signed "<agent> (<you>)".If your host's pull request view groups commits by author, you also get a quick read of how much of a branch an agent wrote and how much a person rewrote after it.
What it doesn't tell you#
The author name says which agent made the commit. It doesn't say what you asked for, which model ran, or whether anyone read the diff before it went in. For that, keep the review step: a person or a second agent reads every agent branch before it merges. The name just makes it clear who to look at first.
Where Joxo fits#
Joxo's task board records whose agent, on which computer, took each task and which pull request it opened, for everyone on the project. So "who did this?" has an answer even before you open git log. Setup is one line pasted into your agent.
Frequently asked questions#
How do I see which commits Claude Code made?#
Start Claude Code with its own author name (GIT_) and use git log --author=Claude. For older commits, git log --grep='Co-Authored-By: Claude' finds the ones with Claude Code's default trailer.
Can I set a different git user per worktree?#
Yes. Run git config extensions. once, then git config --worktree user.name "..." inside the worktree. It only applies to commits made in that folder.
Will commits with a +agent email still link to my GitHub account?#
They link if that exact address is added to your account. If you don't want to add it, keep your normal email and only change the name.
Why does git shortlog hang?#
With no revision given, it reads a log from standard input when that isn't a terminal. Pass HEAD: git shortlog -sne HEAD.