Skip to content

Instantly share code, notes, and snippets.

@bloqhead
Created July 29, 2020 14:00
Show Gist options
  • Save bloqhead/c9528692fa43282bd5dfdc0c605aad0e to your computer and use it in GitHub Desktop.
Save bloqhead/c9528692fa43282bd5dfdc0c605aad0e to your computer and use it in GitHub Desktop.
Automatic signoff for git commits.
#!/bin/sh
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