Skip to content
Latchkey

git interpret-trailers: Usage, Options & Common CI Errors

git interpret-trailers reads and writes the key/value footers at the end of commit messages.

Trailers like Signed-off-by, Reviewed-by, or Co-authored-by power DCO checks and changelog tooling. This command adds or extracts them deterministically, which makes it ideal for commit hooks and CI.

What it does

git interpret-trailers parses the trailer block at the end of a commit message and can add, replace, or normalize trailers according to configured rules, reading the message from a file or standard input.

Common usage

Terminal
git interpret-trailers --trailer "Signed-off-by: A <a@x.io>" msg.txt
git interpret-trailers --parse < commit-msg.txt
git log -1 --format=%B | git interpret-trailers --parse
echo "msg" | git interpret-trailers --trailer "Reviewed-by: B <b@x.io>"

Options

FlagWhat it does
--trailer <token>=<value>Add a trailer
--parseOutput only the parsed trailers
--if-exists <action>addIfDifferent / replace / doNothing
--if-missing <action>add / doNothing when absent
--in-placeEdit the file in place

Common errors in CI

A common DCO failure is a missing Signed-off-by trailer; pipe the message through --parse and assert the token exists. Note that lines must form a valid trailer block (no blank lines inside it) or --parse returns nothing, which scripts can misread as "no sign-off".

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →