-
-
Save sshine/d5a2986a6fc377b440bc8aa096037ef0 to your computer and use it in GitHub Desktop.
Commit under pair-programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Install into e.g. ~/bin/git-co-commit | |
# | |
# Yes, this creates a 'git co-commit' sub-command even though the binary is called 'git-co-commit'. | |
case "$1" in | |
"--halp") | |
cat <<EOF | |
Usage: git co-commit --halp | |
Usage: git co-commit [--person] ... | |
EOF | |
exit 1 | |
;; | |
"--alan") | |
coauthor="Alan Szepieniec <alan@neptune.cash>" | |
;; | |
"--thor") | |
coauthor="sword-smith <thor@neptune.cash>" | |
;; | |
"--simon") | |
coauthor="Simon Shine <simon@neptune.cash>" | |
;; | |
"--einar") | |
coauthor="Einar Rasmussen <einar@neptune.cash>" | |
;; | |
"--ferdinand") | |
coauthor="Ferdinand Sauer <ferdinand@neptune.cash>" | |
;; | |
*) | |
echo "Please specify --person!" | |
exit 1 | |
esac | |
shift # ditch $1 | |
git_path="$(git rev-parse --show-toplevel)/.git" | |
commit_template_path="$git_path/coauthor-commit-template" | |
echo -n "\n\nCo-authored-by: $coauthor\n" > "$commit_template_path" | |
git config commit.template $commit_template_path | |
git commit $@ | |
git config --unset commit.template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment