answered from live GitHub & Hugging Face data
How do I use the Generated-by commit trailer for AI-generated code in my GitHub repository?
Use Generated-by: as a plain git trailer, and document its format in your repo. I found no official standard for this key.
I checked three sources: the Linux kernel AI guidance, git's interpret-trailers reference, and GitHub's co-author docs. None defines Generated-by. The kernel guidance covers Signed-off-by and Fixes, not AI-tool trailers. So the key name and value format are your choice. Write them down so every contributor uses the same form.
Steps
- Write the commit subject and a body paragraph. Leave a blank line before the trailers.
- Add the trailer on its own line, after the body:
Fix retry logic in the upload client Retry failed uploads with exponential backoff, capped at 5 attempts. Generated-by: Claude Code 1.0 (model: example-model) - Commit with one
-mflag for each paragraph:git commit -m "Fix retry logic in the upload client" \ -m "Retry failed uploads with exponential backoff, capped at 5 attempts." \ -m "Generated-by: Claude Code 1.0 (model: example-model)" - To avoid typing the key each time, add a short alias to git config:
Git applies the alias to any file named in the command. Thegit config trailer.gen.key "Generated-by: " git interpret-trailers --trailer "gen: Claude Code 1.0" --in-place msg.txt--trailervalue is trimmed and appended after the existing trailers. - Check the result before you push:
git log -1 --format=%B
Rules to keep
- Do not add
Signed-off-byfor the AI. The kernel guidance says: "AI agents MUST NOT add Signed-off-by tags. Only humans can legally certify the Developer Certificate of Origin (DCO)." If your project uses a DCO, the human submitter adds their ownSigned-off-by. - Do not use
Co-authored-byfor a tool. GitHub's docs say a co-author's email should be tied to their GitHub account for the commit to count as a contribution. A tool cannot hold one. UseGenerated-byfor the tool andCo-authored-byonly for people. - Name the human who is accountable.
Generated-bysays what produced the code. It does not say who reviewed it. Add a separate line or yourSigned-off-byfor that.
Existing tools
- rokokol/ai-commit-trailers-skill ✅ maintained. MIT license, 0 stars, 0 open issues, last push 55 days ago. Its description says it adds
Assisted-byandGenerated-bytrailers for Claude-style agents. I could not open its README because of a rate limit, so I cannot confirm its value format. - ericdahl-dev/coauthor-cleaner ✅ maintained. Last push 45 days ago, no license listed. It removes AI co-author trailers and "generated-by" comments. Use it if you want to strip these lines, not add them.
Both are small, new projects with no stars. Treat them as examples, not as the standard.
How they relate
The kernel guidance uses a different convention from this question. It asks for AI disclosure without a Signed-off-by line from the AI. Generated-by and Assisted-by answer the same disclosure need. Pick one key and use it everywhere.
Recommendation: Add Generated-by: with the tool name and version. Write the format in CONTRIBUTING.md. Keep Signed-off-by for humans only.
If you run several AI agents and want each commit traced to a named human and agent, see githug. It is in beta and free for now. Agent commits carry trailers that name the accountable human, the agent, and the run.