Skip to content

Instantly share code, notes, and snippets.

@corajr
Created June 7, 2016 00:14
Show Gist options
  • Save corajr/10e21f707e9544b24dada8b50cf8fcb0 to your computer and use it in GitHub Desktop.
Save corajr/10e21f707e9544b24dada8b50cf8fcb0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage: copy me to .git/hooks/pre-commit
# chmod +x .git/hooks/pre-commit
# Stash unstaged changes and untracked files before running tests
git stash -q --keep-index -u
# Run non-feature tests
rspec --format progress --tag ~type:feature
FAILED="$?"
# Unstash
git stash pop -q
exit $FAILED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment