Last active
February 11, 2021 21:50
-
-
Save r10r/a9fb7e13fce560263c4363decaac6a3d to your computer and use it in GitHub Desktop.
auto signoff git commit hook
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 | |
# Save me too .git/hooks/prepare-commit-msg and make me executable | |
# Thanks goes to https://stackoverflow.com/questions/15015894/git-add-signed-off-by-line-using-format-signoff-not-working | |
NAME=$(git config user.name) | |
EMAIL=$(git config user.email) | |
if [ -z "$NAME" ]; then | |
echo "empty git config user.name" | |
exit 1 | |
fi | |
if [ -z "$EMAIL" ]; then | |
echo "empty git config user.email" | |
exit 1 | |
fi | |
git interpret-trailers --if-exists doNothing --trailer \ | |
"Signed-off-by: $NAME <$EMAIL>" \ | |
--in-place "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment