Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Last active August 29, 2015 14:11
Show Gist options
  • Save jrafanie/0163a705d7129e1d560f to your computer and use it in GitHub Desktop.
Save jrafanie/0163a705d7129e1d560f to your computer and use it in GitHub Desktop.
post-checkout
#!/bin/sh
#
# Put this in manageiq/.git/hooks/post-checkout
# Make sure you chmod +x !!!
#
# Swap a Rails 4 Gemfile.lock on checkout of rails4 branch
# Put back the master branch Gemfile.lock when checking out a non-"rails4" branch.
#
branch=$(git symbolic-ref -q --short HEAD)
if [ "$branch" = "rails4" ]
then
if [ -f $PWD/vmdb/Gemfile.lock.rails4 ]
then
mv $PWD/vmdb/Gemfile.lock $PWD/vmdb/Gemfile.lock.master
mv $PWD/vmdb/Gemfile.lock.rails4 $PWD/vmdb/Gemfile.lock
fi
else
if [ -f $PWD/vmdb/Gemfile.lock.master ]
then
mv $PWD/vmdb/Gemfile.lock $PWD/vmdb/Gemfile.lock.rails4
mv $PWD/vmdb/Gemfile.lock.master $PWD/vmdb/Gemfile.lock
fi
fi
@matthewd
Copy link

In case it helps(?), here's the one I use on rails/rails: https://gist.github.com/matthewd/14ab543c126a4390646e

@bdunne
Copy link

bdunne commented Dec 18, 2014

Thanks for the inspiration, wrote this: https://gist.github.com/brandondunne/f8761d1c565f2bea92e3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment