Last active
June 24, 2020 14:52
-
-
Save dialex/68b56e903cb1389b03f5940e1d169aa5 to your computer and use it in GitHub Desktop.
co-author commits
This file contains hidden or 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/bash | |
# How to use this little dev tool | |
# | |
# You need to add the following snippet to .git/config | |
# [commit] | |
# template = .git/.gitmessage | |
# | |
# And this is how you should run it | |
# ./pair-with.sh will simply empty the .gitmessage file | |
# ./pair-with DM will create this content: | |
# Co-authored-by: Daniel Moor <[email protected]> | |
# It is also possible to add multiple developers as co authors at the same time: | |
# ./pair-with XY AB MN | |
function co_author() { | |
user=$1 | |
echo "Co-authored-by: $user" >>.git/.gitmessage | |
echo "Now pairing with $user" | |
} | |
echo >.git/.gitmessage | |
while [[ $# -gt 0 ]]; do | |
case $1 in | |
XY) | |
co_author "Name Surname <[email protected]>" | |
shift | |
;; | |
*) | |
echo "Unknown user: $1" | |
shift | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment