Created
June 14, 2014 07:16
-
-
Save matthewd/dc4dc0186d8acb1d0f69 to your computer and use it in GitHub Desktop.
Per-branch Gemfile.lock
This file contains hidden or 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 [ "$3" = 1 ]; then | |
old_branch="`git name-rev --name-only --no-undefined "$1" | cut -d'~' -f1`" | |
new_branch="`git name-rev --name-only --no-undefined "$2" | cut -d'~' -f1`" | |
if [ "$old_branch" != "$new_branch" ]; then | |
mv -f "Gemfile.lock" ".Gemfile/lock.$old_branch" | |
if [ -f ".Gemfile/lock.$new_branch" ]; then | |
mv -f ".Gemfile/lock.$new_branch" "Gemfile.lock" | |
else | |
closest_match="$old_branch" | |
cp -f ".Gemfile/lock.$closest_match" "Gemfile.lock" | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment