Skip to content

Instantly share code, notes, and snippets.

@ocrampete16
Created May 28, 2018 21:58
Show Gist options
  • Select an option

  • Save ocrampete16/5f760726bbd712e524ac6084e07befe1 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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