Skip to content

Instantly share code, notes, and snippets.

@jasonkarns
Created November 6, 2012 04:30
Show Gist options
  • Save jasonkarns/4022554 to your computer and use it in GitHub Desktop.
Save jasonkarns/4022554 to your computer and use it in GitHub Desktop.
Post Checkout git hook to remind me about running certain commands when appropriate files have been modified
#!/bin/sh
if git diff-tree --name-only --no-color -r -m $1 $2 | fgrep -e 'Gemfile' >/dev/null 2>&1
then
echo "\nGemfile modified: run \`bundle install\`\n"
fi
if git diff-tree --name-only --no-color -r -m $1 $2 | fgrep -e 'db/migrate' -e 'db/schema.rb' -e 'db/structure.sql' >/dev/null 2>&1
then
echo "\nSchema modified: run \'rake db:migrate\'\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment