answered from live GitHub & Hugging Face data

How do I use the Generated-by commit trailer for AI-generated code in my GitHub repository?

MaintMaintained · 2mo ago
Stars0
Issues0 open
MaintMaintained · 2mo ago
Stars0
Issues0 open

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

  1. Write the commit subject and a body paragraph. Leave a blank line before the trailers.
  2. 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)
    
  3. Commit with one -m flag 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)"
    
  4. To avoid typing the key each time, add a short alias to git config:
    git config trailer.gen.key "Generated-by: "
    git interpret-trailers --trailer "gen: Claude Code 1.0" --in-place msg.txt
    
    Git applies the alias to any file named in the command. The --trailer value is trimmed and appended after the existing trailers.
  5. Check the result before you push:
    git log -1 --format=%B
    

Rules to keep

Existing tools

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.

docs.kernel.org/process/coding-assistants.htmlgit-scm.com/docs/git-interpret-trailersdocs.github.com/en/pull-requests/how-tos/commit-changes/creating-a-commit-with-multiple-authorsgithub.com/rokokol/ai-commit-trailers-skillgithub.com/ericdahl-dev/coauthor-cleanerdocs.kernel.org/process/submitting-patches.html
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 11/17/2026

Ask your own open-source question →