Do you use Co-Authored Commits?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
<introEmbed body={<> When using [co-creation patterns](/co-creation-patterns) such as pair-programming or mob-programming, you should make sure that all the developers get attribution. When done correctly co-authored commits stand out as a testament to teamwork and shared responsibility, reflecting the collaborative efforts and diverse expertise contributed to each change. <imageEmbed alt="Image" size="large" showBorder={true} figureEmbed={{ preset: "default", figure: 'GitHub - Co-Authored Commit', shouldDisplay: true }} src="/uploads/rules/co-authored-commits/github.png" /> </>} />

There are several different ways to create co-authored commits, depending on the tools you are using.

Live-Share

If you use Visual Studio Live Share to collaborate, it will co-author the git commits with everyone on the share session

Visual Studio Code

Visual Studio Code the Git Mob Extension can be used to co-author commits.

Rider

Rider has a great UI that makes creating co-authored commits easy. It provides intellisense for the co-authored commit trailer, and will suggest the names of the people who have access to the git repository.

Image

Figure: Rider - Co-Authored Commits

GitHub Desktop

GitHub Desktop supports co-authored commits out of the box.

Image

Figure: GitHub Desktop - Co-Authored Commits

Git CLI

When writing the commit message, leave 2 blank lines, and give each co-author their own line and Co-authored-by: commit trailer

$ git commit -m "Refactor usability tests.
>
>
Co-authored-by: NAME <NAME@EXAMPLE.COM>
Co-authored-by: ANOTHER-NAME <ANOTHER-NAME@EXAMPLE.COM>"

Acknowledgements

Matt Wicks
Daniel Mackay
Brady Stroud
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.