Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to automatically run bundle install if the gemfile is updated after a git pull/merge?

Tags:

git

ruby

bundler

I imagine that I should write a git commit hook (post-merge?) that would look at the list of changed files and run bundle install if necessary after I fetch and merge from my git repo.

But after some googling, I figure that either this should exist (couldn't find it!) or there's a good reason not to do this.

like image 488
rkabir Avatar asked Oct 27 '10 18:10

rkabir


2 Answers

You can create a post-merge hook that will fire everytime you pull changes:

~/.git/post-merge

... and set it up to re-install bundle if needed:

bundle check || bundle install
like image 146
Winfield Avatar answered Oct 06 '22 07:10

Winfield


Using rerun you can automatically run bundle install on Gemfile changes:

rerun --no-notify --pattern "Gemfile*" "bundle check || bundle install; true"
like image 23
Dorian Avatar answered Oct 06 '22 09:10

Dorian