5

I sometimes want to give props to the users who designed something for me, gave me the idea, created the issue that led to a PR or submitted a PR I closed but ended up adding half of it myself.

How can I add commits that are co-authored on GitHub?

Ahmad Awais
  • 23,458
  • 4
  • 66
  • 52

2 Answers2

9

It can be done very easily by using the GitHub Desktop Software:

GitHub Co Authors

Commit together with co-authors via GitHub Desktop:

GitHub Co Authors

You can also read Creating a commit with multiple authors and Commit together with co-authors

To add co-authors to a commit, just add one or more co-authored-by trailers to the end of the commit message:

Commit message

Co-authored-by: Joel Califa <602352+califa@users.noreply.github.com>
Co-authored-by: Matt Clark <44023+mclark@users.noreply.github.com>

Include your trailers at the end of your commit message, and have at least one line of white space before them.

Ahmad Awais
  • 23,458
  • 4
  • 66
  • 52
  • 2
    See https://stackoverflow.com/a/41847267. this is just a convention and you could put those lines at the end of any commit message. – Patrick Mevzek Jan 29 '18 at 22:40
9

Alternatively, there is an open source project, which I contribute to, on GitHub that provides a good way to do it from the command line. This project helps you to set an alias in order to create co-autored commits as follows:

$ git co-commit -m "Commit message" --co "co-author <co-author-email>"

Using this approach, you are able to create co-authored commits without a graphical interface.

foo0x29a
  • 466
  • 4
  • 5