git mob
CLI app to help you automatically add Co-authored-by trailers to git commits during pair/mob programming
You can attribute a git 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. For more information, see here.
This CLI app will help you add them automatically and also help you store and manage co-authors for pair/mob programming sessions.
Co-authored-by
trailers to commitPATH
variable e.g. you may place the file in C:\Windows
on Windows or /usr/local/bin
on Linux and macOSsh
$ chmod +x ./git-mob
sh
$ cargo install git-mob-tool
Store your team members' details with keys (usually initials)
sh
$ git mob coauthor --add lm "Leo Messi" leo.messi@example.com
$ git mob coauthor --add em "Emi Martinez" emi.martinez@example.com
$ git mob coauthor --add sa "Sergio Aguero" sergio.aguero@example.com
...
Set a global githooks
directory
sh
$ mkdir ~/git
$ git config --global core.hooksPath "~/git"
Download the prepare-commit-msg
file into the directory
Ensure it is set as executable (Linux and macOS)
sh
$ chmod +x ./prepare-commit-msg
This githook
will be used to append the Co-authored-by
trailers to the commit's message.
This githook also adds a Jira Issue ID as a prefix to the commit message if the branch name starts with a string resembling one. If you don't want want this, comment out line 42 which calls the function add_jira_issue_id_prefix
.
To mob with some team member(s):
``` $ git mob --with ? Select active co-author(s):
[ ] Leo Messi leo.messi@example.com [ ] Emi Martinez emi.martinez@example.com [ ] Sergio Aguero sergio.aguero@example.com [↑↓ to move, space to select one, → to all, ← to none, type to filter ] ```
Alternatively, if you remember the co-author keys, you may bypass the multi-select menu by running:
sh
$ git mob --with lm em
This will start a global mob session. Any git commit made afterwards will have Co-authored-by
trailers added to the commit message as shown below:
``` This is an example commit message
Co-authored-by: Leo Messi leo.messi@example.com Co-authored-by: Emi Martinez emi.martinez@example.com ```
To clear the mob session:
sh
$ git mob --clear
To view the co-authors in the current mob session:
sh
$ git mob --list
To print help information:
sh
$ git mob help
$ git mob help coauthor