answered from live GitHub & Hugging Face data
How do I use commit trailers like Generated-by to differentiate AI-written code from human contributions in GitHub?
GitHub does not give Generated-by any meaning. Use a trailer key that your team agrees on, and enforce it in your own tooling.
GitHub's docs give trailer meaning only to Co-authored-by and on-behalf-of. I found no GitHub feature that reads or filters Generated-by or Assisted-by.
What each trailer does
| Trailer | Who reads it | Effect |
|---|---|---|
Co-authored-by: Name <email> |
GitHub | Adds a second author. The commit counts on that person's contribution graph only if the email is linked to their GitHub account (GitHub docs). |
on-behalf-of: @org <email> |
GitHub | Shows an organization badge. Requires a signed commit and a verified domain (same page). |
Assisted-by: ... |
Kernel convention, tooling | Discloses AI help. The kernel guide I read does not define this trailer. |
Generated-by: ... |
No standard found | Only your team's convention. |
Git accepts any key made of letters, digits and hyphens (git-interpret-trailers). So both Assisted-by and Generated-by are valid syntax.
How to mark AI-written commits
- Pick one key. Use
Assisted-byif you follow kernel-style rules. Otherwise, pickGenerated-byand write it in yourCONTRIBUTING.md. - Put the trailer in a block after the body. Leave one blank line before the trailer block, as GitHub's example shows:
git commit -m "Refactor usability tests. Split the fixture setup into a helper. Assisted-by: Claude Code (model-name)" - Do not add
Signed-off-byfor AI. The kernel rule says AI agents must not add it. A human adds their ownSigned-off-byto certify the Developer Certificate of Origin (kernel guide). - Use
Co-authored-byfor humans only. Use it when a person co-wrote the change and their email is linked to GitHub. Do not use it as the AI marker. - Check the trailers before you push.
git log -1 --format=%B | git interpret-trailers --parse - Automate the check. A commit-msg hook or CI job can reject commits that lack the key. I found one small project for this: bcmyguest/assisted-by. It is a Claude Code plugin that enforces the
Assisted-by:trailer. It has 2 stars, was last pushed 166 days ago, and has no declared license (NOASSERTION). It is maintained, but adoption is very low. Review it before you depend on it.
Limits
- Trailers record what the author wrote. They do not prove who generated the code.
- Each team must agree on one key. Mixed keys make the history hard to query.
Recommendation
Use Assisted-by: on every AI-assisted commit, and add a CI check that fails when it is missing. This follows the kernel's vocabulary, and the check makes the rule real. Use Generated-by: only if your own policy needs a different meaning.
If you want the agent's identity and the accountable human recorded for you, githug does this. Agent commits carry trailers that name the human, the agent and the run.