Skip to content

Instantly share code, notes, and snippets.

@tooky
Last active March 22, 2018 14:02
Show Gist options
  • Save tooky/8e9350589335c469364ae7816c442f9d to your computer and use it in GitHub Desktop.
Save tooky/8e9350589335c469364ae7816c442f9d to your computer and use it in GitHub Desktop.
prepare-commit-msg hook to include potention Co-authors
Co-authored-by: Joanne Bloggs <[email protected]>
Co-authored-by: John Dowe <[email protected]>
#!/usr/bin/env sh
firstLine=$(head -n1 $1)
mobbers="$(dirname $0)/../.mobbers"
exec < /dev/tty
awk '{printf("%d: %s\n", NR, $0)}' $mobbers
read -p "Select co-authors (enter to continue): " selected
coauthorLines=$(echo $selected | sed -Ee 's/([0-9]+)/\1p;/g')
exec <&-
if [ -z "$firstLine" ] ;then
echo "\n\n${coauthorLines}$(cat "$1")" > "$1"
fi
@tooky
Copy link
Author

tooky commented Mar 22, 2018

This now lets you choose your co-authors before you edit your commit message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment