Adding commit message trailers with Magit

In this quick tip post, I cover how adding messages such as Co-authored-by or Signed-off-by with Magit.

These commit annotations are sometimes called trailers but referred to as pseudo headers by Magit. These messages can provide additional data to your commit messages and, in the case of Co-authored-by, can be used by GitHub to attribute a commit to multiple authors.

When writing a commit (in the Git-Commit minor mode), you can call the function git-commit-insert-pseudo-header to open a transient menu with options for annotating your commit.

psuedo-header-list

When selecting an annotation that references someone else (e.g., Co-Authored-By), magit will open up a completion buffer with the names of people that commit to your repository. Here is an examplef when committing to the doom-emacs repo.

co-author-list

By default, this function is mapped to C-c TAB.

Key Bindings
git-commit-mode-map C-c TAB

Notice something wrong? Please consider proposing an edit or opening an issue.