Skip to content

Instantly share code, notes, and snippets.

@davidpdrsn
Created January 27, 2016 10:29
Show Gist options
  • Save davidpdrsn/446b6cae8d59b0909069 to your computer and use it in GitHub Desktop.
Save davidpdrsn/446b6cae8d59b0909069 to your computer and use it in GitHub Desktop.
Git pre-push hook that prevents you from pushing commits with "WIP" in the message
#!/bin/sh
# Prevent you from pushing commits that have "WIP" in the message
branch=`git branch 2>/dev/null | grep '^*' | colrm 1 2`
git log $branch ^origin/$branch --pretty="format:%h %s" | grep "WIP"
if [[ $? -eq 0 ]]; then
echo "Found commits with WIP messages"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment