co-author
Give credit to your teammates when pairing or mob-programming.
Use Case
When working within a team, it's useful to know who to ask when struggling with a piece of code.
Git blame is awesome, but only the committer is mentioned.
This is a shame since we often are (should be) working with others. It helps to know who else was involved (maybe the committer is not available at the moment).
There are plenty of editor plugins that follow GitHub's guidelines for co-authoring commits.
This is a simple CLI tool that achieves the same thing, while being editor independent and easy to integrate into your existing workflows.
Installation
Usage
The tool expects a CSV authors file in $XDG_CONFIG_HOME/coa/authors
(defaults to $HOME/.config/coa/authors).
This file should follow the structure alias,name,email, as in the example:
a,Name Surname,someone@users.noreply.github.com
b,username,something@gmail.com
cd,Another Surname,someone@something.hi
If no options are passed, it will prompt you for a space-separated list of aliases and then for a commit message.
It will produce a commit message with the formatted as follows:
a commit message
Co-Authored-by: Name Surname <someone@users.noreply.github.com>
Co-Authored-by: username <something@gmail.com>
If you group multiple users under the same alias, they will all be co-authors.
This is especially useful if you jump between various teams.
So for a file like:
a,Name Surname,someone@users.noreply.github.com
a,username,something@gmail.com
When given the alias a, it will add both users as co-authors.
Options
You can modify the behavior in a number of ways, most will bypass the prompt:
)
)
--file
Use a specific file path.
You might want one per-project.
--list
Use a pre-defined alias list.
Something like
Might be useful.
--all
Use all the aliases in the file.
Conflicts with --list.
--message
Just like git's -m: Specify a commit message.
--editor
Just like git's default behavior: Fill in the commit message in a text editor.
It will look for the editor config in your git setup, defaulting to
$EDITOR, vim and vi in that order.
--pre-populate
Pre-populate either the prompt or the editor with the last commit message (not considering possible co-authors).
If you use Conventional Commits or other standards you might want the same general format, just with a different type.
Conflicts with --message.
--sort
Sort authors alphabetically by signature (username <email>).
If not used it will respect the order in the authors file.