DEV Community

Discussion on: Co-authoring Git commits

Collapse
 
jake_nelson profile image
Jake Nelson

Can you do this trailer action on an amend? Is it just containing that other email in the required format within the commit body message that does this or is it some kind of annotation?

Collapse
 
valscion profile image
Vesa Laakso

Yeah I think you can do a

git commit --amend --trailer 'Co-authored-by: name <person@example.com>'
Enter fullscreen mode Exit fullscreen mode

to get what you want.

And couple that with --reuse-message=HEAD to only add the trailer to the most recent commit and not even trigger an editor to open up:

git commit --amend --trailer 'Co-authored-by: name <person@example.com>' --reuse-message=HEAD
Enter fullscreen mode Exit fullscreen mode