Commit together with multiple users on Github

Image for post
Image for post

I don’t know about you, but I love to pair program with my team members. We build a ton of features with multiple people. But is was never possible to bind multiple authors to a single commit.

But since the end of January 2018 Github came with some news about a possibility to commit with co-authors. That is awesome news Github!!

Off-course I had to check that out! And it seems pretty easy. In this blog I want to share with you how you can do that to!

Add an co-author to your commit

I’m a fan of using the terminal for git instead of a GUI. But adding a co-author can be done on both.

Terminal

On the terminal you start writing your commit message as usual. But now you add 2 empty lines and put in a row of Co-authored-by: Firstname Lastname <usernam@users.noreply.github.com> for every co-author. After the last line of the co-author you close the message with the quotes.

For every co-author you need a name, that can be a first and lastname or a name of choice. After the name you add a email address of that user between the <> arrows.

If a co-author wil keep his/her emailadress private you can simply use the github noreply emailadress “githubusername@users.noreply.github.com”.

Git GUI and via Github website

Via a Git GUI of choice and via the Github website you can also make changes to a file. If you do that, below the file will be a field for your commit message.

Then just put in the same message as in the terminal.

Result

Than in your commit log on Github you will se the author and co-authors instead of only 1 author.

Image for post
Image for post
Image from https://blog.github.com/2018-01-29-commit-together-with-co-authors/

Thanks

If you have some additional Github tips or some questions? Please let me know on twitter 😉: @rsschouwenaar

Written by

I write stories about Frontend Dev, JavaScript, Typescript, Angular, NodeJS, Serverless Functions, JAM Stack, FaunaDB, Netlify, Apple, iOS— https://byrayray.dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store