Skip to content

Instantly share code, notes, and snippets.

@blocknotes
Last active July 27, 2021 12:15
Show Gist options
  • Save blocknotes/c649b0c02c2428c6e2eaebdc0def1c5b to your computer and use it in GitHub Desktop.
Save blocknotes/c649b0c02c2428c6e2eaebdc0def1c5b to your computer and use it in GitHub Desktop.
Find specs in a commits range - Execute them
# All specs in the diff commits from develop (useful to check a specific branch):
git diff-tree --no-commit-id --name-only -r develop..HEAD | grep '_spec\.rb' | sort | uniq > /tmp/specs
# All specs in a specific range of commits:
git diff-tree --no-commit-id --name-only -r HEAD~3..HEAD | grep '_spec\.rb' | sort | uniq > /tmp/specs
# Execute them:
while read p; do; if [ -f "$p" ]; then; be rspec "$p" || break; fi; done </tmp/specs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment