Commits
Co-authors and Signed-off-by
9 min read
Trailers are lines at the end of the commit message in the Key: value format. Git, GitLab and
GitHub understand some of them:
Co-authored-by: Name <email>says that another person also wrote the commit (pair programming, a review that turned into code). GitLab and GitHub show that person on the commit.Signed-off-by: Name <email>is the certificate of origin for the code (DCO): whoever commits declares that they can contribute that code. Many projects require it.- The AI co-authorship trailer is a
Co-authored-bythat the team uses to mark code written with AI help, when.versora.ymlasks for it.
In Versora, the commit description is the source of truth: what's written in it is exactly what goes into the commit. The buttons only add or delete the trailer lines.
- Commit box › Co-authors button, below the description (tooltip: "Add other people as co-authors of the commit (Co-authored-by trailer)"). With people chosen, the button shows "2 co-authors".
- The chosen people show up next to the button, with the X to remove them.
- Click Co-authors. The Commit co-authors list opens, with the "Search for a person, email or username…" field.
- While the list loads, "Reading the authors and the project members…" appears.
- Type part of the name, email or username. The search ignores accents and case.
- Click the person (or move with the arrow keys and press Enter). They get a ✓ and go into the message. Click again to remove them.
- For someone who isn't on the list, type
Ana Souza <[email protected]>and choose Add Ana Souza. Just the email also works. - Close the list with Esc or by clicking outside. The chosen people show up next to the button; the X on each one ("Remove Ana Souza from the co-authors") removes the person from the message.
- Commit. Each person becomes a
Co-authored-by: Ana Souza <[email protected]>line.
Where the suggestions come from:
| Group in the list | Who shows up | Details |
|---|---|---|
| Committed to this repository | Authors and co-authors of the last 1500 commits on the current branch | Most recent first, with the number of commits ("12 commits"). Up to 80 people read and 30 shown. You don't show up (by your user.email) |
| Project members on GitLab / Project members on GitHub | GitLab: the project members, including those inherited from groups; GitHub: those who can be assignees of the repository | Only with the server added with a token. Inactive accounts, bots and token service accounts are left out, as is the token owner. Up to 300 members read and 60 shown |
Someone who is a member and has also committed shows up only once, with the email from the commits
and the username (@ana.souza).
When the server doesn't provide a member's email, the app suggests the private email that the service links to the person, marked with noreply:
- GitLab:
<id>-<username>@users.noreply.<server>; - GitHub:
<id>+<username>@users.noreply.github.com.
Where the line goes in the description:
- in the last paragraph, if it's already a trailer block (all lines
Key: value); - otherwise, in a new paragraph at the end. A
BREAKING CHANGE:footer doesn't count as a trailer block for git: the co-authors go into a paragraph after it.
To make suggestions, the app reads the history:
git config user.email
git log --max-count=1500 \
--format="%aN%x1f%aE%x1f%at%x1f%(trailers:key=Co-authored-by,valueonly,separator=%x1d)%x1e"
and, with the server added, the API (/projects/:id/members/all on GitLab, /repos/:owner/:repo/assignees
on GitHub). The commit is the usual one, with the lines in the message:
Fix the login form validation
The email is now compared case-insensitively.
Co-authored-by: Ana Souza <[email protected]>
Co-authored-by: Bruno Lima <[email protected]>
- Before the commit: the person's X, or clicking them again in the list, deletes the line. Deleting the line by hand in the description also removes the person.
- After the commit: Ctrl+Z undoes the commit; or use Amend to fix the list.
- "No one by that name. Type "
Name <email>" to add someone else.": the search didn't find anyone. - "No one to suggest yet. Type "
Name <email>".": a repository with no commits and no server. - "To suggest the project members, add the server in Git servers.": the remote has no server with a token (see Servers and accounts).
- "Project members unavailable: …": the API refused (no permission, server down). The suggestions from the history are still there.
- The noreply tooltip: "The service's private (noreply) email: GitLab/GitHub links the commit to the person through it. Check whether they use another one."
- Writing
Co-authored-by: …by hand in the description also works: the person shows up next to the button. - With Amend, the previous commit's message comes with its co-authors.
- Templates don't save co-authors, and switching templates keeps the chosen co-authors.
- Automatic wrapping of the description doesn't touch trailer lines.
- The project members depend on the server being added in Git servers, with a token.
Signed-off-by can go into the message in four ways: written by hand, added to every commit in
the repository by a choice of yours, added when a push rule requires it, or added because the team
or the company requires it. In the last three cases, Versora writes the line with your identity
(user.name and user.email).
- By hand: in Description (optional), the
Signed-off-by: Name <email>line. - Always, in this repository: Preferences › Push rules › Signed-off-by › Add to every commit (the Add switch).
- When a push rule requires it: the "Before committing: push rules" dialog, with Add Signed-off-by and Always add it in this repository.
- By the team or the company: the rules strip in the commit box, with "Signed-off-by will be added (…)".
- Palette (Ctrl+P): "Preferences: Push rules".
- Open the repository in a tab.
- Go to Preferences › Push rules › Signed-off-by.
- Turn on Add: "Adds
Signed-off-by: Name <email>(your identity) to every commit message in this repository, like git commit -s." - Commit as usual. The line goes into the message at commit time (it doesn't show up in the box beforehand).
- Commit. If a push rule requires
Signed-off-by("Require Signed-off-by (DCO)") and the message doesn't have it, the "Before committing: push rules" dialog shows "The message is missing the Signed-off-by line (DCO)", with the line that will be added. - Click Add Signed-off-by ("Signed-off-by added to the message." appears).
- To stop seeing the warning in this repository, check Always add it in this repository (it's the same option as in Preferences › Push rules; checking it already adds the line to this commit).
- Go ahead with the commit.
| Source | Where it's set | Default value |
|---|---|---|
| Your choice, per repository | Preferences › Push rules › Signed-off-by › Add to every commit | Off |
| Push rule | reject_non_dco_commits (GitLab, .versora/push-rules.json or local rules) | Depends on the server or the file |
| Team rule | .versora.yml: commit.signoff: true | Off |
| Company policy | commit_signoff: required | Not set |
The "Add to every commit" choice applies only on this computer. For the whole team, use
.versora.yml or the push rules.
The app takes the identity of whoever is going to commit and adds the line without repeating one that already exists:
git var GIT_COMMITTER_IDENT
git interpret-trailers --if-exists addIfDifferent \
--trailer "Signed-off-by: Ana Souza <[email protected]>"
git commit -F -
It's the same result as git commit -s.
Ctrl+Z undoes the commit. To remove just the line, use Amend and delete it from the description (if no rule requires it, it doesn't come back). To stop adding it, turn off Add in Preferences.
- "Your Git identity (user.name and user.email) isn't set." and "No git identity (user.name and user.email): Signed-off-by can't be written.": without an identity, the line can't be written; the commit is canceled. See Identity.
- "The "
Signed-off-by: Name <email>" line is missing": a commitlint warning, when the repository has thesigned-off-byrule. - With the team rule on, the strip doesn't flag the missing
Signed-off-by: it will be added at commit time.
- Preferences › Push rules › Signed-off-by.
- Checks (push rules) and The .versora.yml file.
Some teams record in their commits when code was written with AI help. The app has no way of
detecting that, so it asks: .versora.yml (or the company policy) sets whether the question is a
suggestion or required, and which trailer goes into the message.
- Commit box › the rules strip, above the commit button.
- Write the message.
- If the mode is suggested, check Has code written with AI help when that's the case.
- If the mode is required, answer AI-written code? with Yes or No. Until you answer, the strip shows "answer before committing".
- If the team set more than one trailer, choose which one in the AI trailer selector. With only one, the strip shows its text.
- Commit. With Yes (or the box checked), the trailer goes into the message.
- In required mode, if you commit without answering, the AI-written code? dialog asks first
("This commit has to say whether it has code written with AI help (team rule (.versora.yml)).
The answer becomes a co-author trailer in the message."). In Does this commit have AI-written
code?, choose No, no AI code or Yes —
Co-authored-by: AI Assistant <[email protected]>and click Commit.
| Key | Values | Effect |
|---|---|---|
commit.ai_coauthor (.versora.yml) or ai_coauthor (company) | off, suggested, required | Off; "Has code written with AI help" checkbox; required Yes or No question |
commit.ai_trailer (.versora.yml) or ai_trailer (company) | A string or a list of Key: value | The trailer (the first one on the list is the default). Without it, Co-authored-by: AI Assistant <[email protected]> applies |
When the sources disagree, the strictest mode applies; the company's trailer text wins over the team's.
git interpret-trailers --if-exists addIfDifferent \
--trailer "Co-authored-by: AI Assistant <[email protected]>"
git commit -F -
- Before the commit: uncheck the box or answer No.
- The answer applies only to the next commit: after a commit, the question comes back for the next one.
- After the commit: Ctrl+Z or Amend.
- "The AI trailer is already in the message.": you (or a template) already wrote the trailer; the app doesn't add it again.
- Closing the AI-written code? dialog without answering cancels the commit; the message stays in the box.
After the commit, the trailers show up as people, and not as loose text, in the commit details and in blame.
- Select a commit in the graph: the right panel shows, below the author, the Co-author (or Co-authors) and Signed-off-by groups, each person with initials, name and email.
- In blame, a commit block with co-authors gets a "+2" mark next to the author (tooltip: "With Ana Souza, Bruno Lima").
- Click a commit in the graph.
- In the right panel, see the message (the body shows up without the trailer lines) and, below
the author, the co-authors and who signed the
Signed-off-by(tooltip: "Who signed off the commit (Signed-off-by), certifying where the code comes from").
It only reads the commit message.