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?
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.
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 .
It can be done very easily by using the GitHub Desktop Software:
Commit together with co-authors via GitHub Desktop:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With