Created
January 27, 2016 10:29
-
-
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
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/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