Created
June 8, 2012 20:05
-
-
Save mckeed/2897878 to your computer and use it in GitHub Desktop.
A useful post-merge git hook for Rails projects. Automatically runs bundle install and rake db:migrate. Put it in .git/hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -z `git diff --name-only HEAD@{1}..HEAD Gemfile` ] | |
then | |
echo -e "\033[0;31m*** Gemfile change detected, running bundle install ***\033[0m" | |
bundle install | |
fi | |
if [ ! -z `git diff --name-only HEAD@{1}..HEAD db/migrate` ] | |
then | |
echo -e "\033[0;31m*** Migration changes detected, running rake db:migrate ***\033[0m" | |
rake db:migrate | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment