Created
May 28, 2018 21:58
-
-
Save ocrampete16/5f760726bbd712e524ac6084e07befe1 to your computer and use it in GitHub Desktop.
A pre-commit hook that only lets you commit when your tests pass
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 | |
| git stash --keep-index | |
| git clean --force | |
| make run-tests # for example | |
| tests_passed=$? | |
| git stash pop | |
| exit $tests_passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment