git-pair
is a bash script that enables you to simply add your co-authors to your commits.
Acknowledge everyone that contributes to the commit.
See example with many authors.
- Amend previous commit message by appending
Co-authored-by: ..
- See here
- Autocompletion
git-pair <TAB><TAB>
- Multiple Co-authors
- Idempotent
- Co-authors will be unique and sorted alphabetically
-
Clone the repo
git clone https://github.com/ninth-dev/git-pair.git
-
Create an file
$HOME/.git-pair
and add your team matese.g.
# Follow the pattern: alias name <email> ( echo "john-smith John Smith <[email protected]>" echo "jane-doe Jane Doe <[email protected]>" echo "alice Alice <[email protected]>" echo "bob Bob <[email protected]>" ) > $HOME/.git-pair
NB: You can just open the file
$HOME/.git-pair
and use your favourite editor :) -
Source the
git-pair
script to your shell startup file (e.g..zshrc
,.bashrc
)source <PATH_TO_GIT_PAIR>/git-pair.sh
-
Restart your shell or source your startup file.
After committing and you want to add your pair (co-author) in.
$ git commit --message "nit: some random bugfix"
$ git-pair john-smith
🍐'd with John Smith <[email protected]>
This will amend the previous commit message :
$ git log -1
.
.
Co-authored-by: John Smith <[email protected]>
$ git-pair jane-doe
🍐'd with Jane Doe <[email protected]>
$ git log -1
.
.
Co-authored-by: Jane Doe <[email protected]>
Co-authored-by: John Smith <[email protected]>
You could also simply just create an alias for your mob-programming sessions.
alias git-mob='git-pair john-smith && git-pair jane-doe && git-pair alice && git-pair bob'
$ git-mob
🍐'd with John Smith <[email protected]>
🍐'd with Jane Doe <[email protected]>
🍐'd with Alice <[email protected]>
🍐'd with Bob <[email protected]>
$ git log -1
.
.
Co-authored-by: Alice <[email protected]>
Co-authored-by: Bob <[email protected]>
Co-authored-by: Jane Doe <[email protected]>
Co-authored-by: John Smith <[email protected]>
# NB: Co-authors are sorted alphabetically