A mini set of shell scripts to enable you to take advantage of commits with coauthors in Github.
See my blog post on the benefits of pair programming.
- Chris Beams does a great job of explaining why good git commits are important. Git coauthors extend all the points he makes.
- Those sweet, sweet, contribution points. 💚
- Clone this repo into your home directory. 🏠
git clone https://github.com/sadir/git-pairing-session.git $HOME/
- Add the
git-pairing-session
script to your bash config (e.g. in~/.bash_profile
or~/.bashrc
).
source $HOME/git-pairing-session/git-pairing-session
- Setup your colleagues so
git-pairing-session
knows who you can 🍐 with.
add_colleague ms "Morgan Sadr-Hashemi" "morgan@example.com"
Note: your colleagues email addresses must match their github email.
You can remove colleagues too if they abandon you:
remove_colleague ms
There are two options:
- Record your coauthor as you go.
- Retrospectively modify your branch to add your coauthor to every commit.
- Set up your project to be ready for recording coauthors as you go, by running this command in the root of your project (where your
.git
directory is).
pairing_project # symlinks a git hook to append authors to your commit messages.
Note: this will ask your permission to override your current prepare-commit-msg
git hook if you have one.
- Get pairing with someone! 💪
pairing_with ms # hand it a set of initials you set up earlier
- When you're done, stop recording your coauthor.
no_longer_pairing
- Eat more fruit 🍐 🍇 🍊 🍏 🍌 🍒
-
Do your work, blissfully unaware that you've forgotten to record your coauthor.
-
Retrospectively amend your branch to add coauthors.
paired_with ms
- Eat more fruit 🍐 🍇 🍊 🍏 🍌 🍒
Set this variable if you cloned the repo somewhere else:
export GIT_PAIR_SESSION_DIR=$HOME/git-pairing-session
I had a look at a few of these:
This one randomly attributes the commit to one member of the pair. I wanted each commit to be attributed to both.
This one put both co-authors in as the commiter but that broke the way that github represented commiters. Git the vcs wasn't set up for that.
Similar to git-pair, with added downsides of not being maintained and I quite wanted something in shell script without any dependencies other than Git, rather than using JS.