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 <john.smith@example.com>" echo "jane-doe Jane Doe <jane.doe@example.com>" echo "alice Alice <alice@example.com>" echo "bob Bob <bob@example.com>" ) > $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 <john.smith@example.com>
This will amend the previous commit message :
$ git log -1
.
.
Co-authored-by: John Smith <john.smith@example.com>
$ git-pair jane-doe
🍐'd with Jane Doe <jane.doe@example.com>
$ git log -1
.
.
Co-authored-by: Jane Doe <jane.doe@example.com>
Co-authored-by: John Smith <john.smith@example.com>
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 <john.smith@example.com>
🍐'd with Jane Doe <jane.doe@example.com>
🍐'd with Alice <alice@example.com>
🍐'd with Bob <bob@example.com>
$ git log -1
.
.
Co-authored-by: Alice <alice@example.com>
Co-authored-by: Bob <bob@example.com>
Co-authored-by: Jane Doe <jane.doe@example.com>
Co-authored-by: John Smith <john.smith@example.com>
# NB: Co-authors are sorted alphabetically