Skip to content

Instantly share code, notes, and snippets.

@ndelage
Last active August 29, 2015 14:22
Show Gist options
  • Save ndelage/2c1d8cd9b7b0d0cbd795 to your computer and use it in GitHub Desktop.
Save ndelage/2c1d8cd9b7b0d0cbd795 to your computer and use it in GitHub Desktop.
recently modified rspec files
#!/bin/bash
# Find modified specs between HEAD and some other point in the
# commit history. Defaults to comparing between master & HEAD.
#
# Supply an optional alternative point in history as the first & only
# argument:
# recent_specs.sh HEAD~8
#
#
# Easily run specs with xargs:
# recent_specs.sh | xargs spring rspec
if [ -z "$1" ]; then
BRANCH='master'
else
BRANCH=$1
fi
git diff --name-only $BRANCH HEAD | grep "^spec" | uniq | while read F; do
if [ -f "$F" ]
then
echo $F
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment