uv tool install git+https://github.com/gelt-technologies/co-authorsAdd the following alias to your shell config (~/.bashrc, ~/.zshrc, etc.):
alias git="co-authors"Then reload your shell:
source ~/.zshrc # or ~/.bashrcWith this alias in place, all git commands pass through co-authors transparently. Only git commit gets special handling — everything else is forwarded to the real git binary unchanged.
Set GIT_AGENT to the agent key for automatic Co-Authored-By trailer injection:
GIT_AGENT=claude git commit -m "Add feature"
# Commits with: Co-Authored-By: Claude <claude[bot]@users.noreply.github.com>For persistent attribution in a session (e.g. inside a Claude Code session), export the variable:
export GIT_AGENT=claude
git commit -m "Add feature"When GIT_AGENT is not set and no -m message is provided, co-authors prompts you to select an agent interactively:
git commit
# Displays a selection prompt: claude, copilot, cursor, gemini, or NoneUse --agent to specify the agent for a single commit without setting GIT_AGENT:
git commit -m "Add feature" --agent claude
git commit -m "Add feature" --agent=claudeThis also overrides GIT_AGENT if it is already set.
Use --me to skip trailer injection entirely — useful when GIT_AGENT is exported but a particular commit is your own work:
git commit -m "Fix typo" --meIf -m is provided but GIT_AGENT is not set and --agent is not used, the commit proceeds without any trailer — no prompt is shown.
All non-commit subcommands are passed through unchanged:
git status # forwarded directly to git
git push # forwarded directly to git| Agent key | Co-Authored-By trailer |
|---|---|
claude |
Claude <claude[bot]@users.noreply.github.com> |
cursor |
Cursor <cursor[bot]@users.noreply.github.com> |
-m flag |
GIT_AGENT set |
--me |
--agent |
Behaviour |
|---|---|---|---|---|
| yes | yes | no | no | Append trailer via --trailer (unless already present) |
| yes | no | no | no | Pass through unchanged |
| no | yes | no | no | Append trailer via --trailer |
| no | no | no | no | Interactive prompt to select an agent (or none) |
| any | any | yes | no | Pass through unchanged (no trailer) |
| any | any | no | set | Append trailer for the given agent (overrides env) |
Trailers are never duplicated — if the same Co-Authored-By value is already present, it is not added again.
