Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create GitHub commits with multiple authors? [duplicate]

Tags:

git

github

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?

like image 224
Ahmad Awais Avatar asked Jan 29 '18 22:01

Ahmad Awais


People also ask

Can a git commit have multiple authors?

You can attribute a commit to more than one author by adding one or more Co-authored-by trailers to the commit's message. Co-authored commits are visible on GitHub.

How do I remove a co author from GitHub?

Key commands Select co-authors - CTRL+shift+p or ⌘+⇧+p -> "Select co-authors". Use the multi-selector to add and remove co-authors. Add new co-authors from repository contributors or add directly to your co-authors file . git-coauthors .


2 Answers

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 <[email protected]>
Co-authored-by: Matt Clark <[email protected]>

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

like image 58
Ahmad Awais Avatar answered Oct 12 '22 12:10

Ahmad Awais


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.

like image 26
foo0x29a Avatar answered Oct 12 '22 13:10

foo0x29a