Created
October 25, 2015 16:16
-
-
Save campbellwmorgan/e8daaab4a7ebd1737c77 to your computer and use it in GitHub Desktop.
Custom Sitechef config files for different git branches
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 | |
####### | |
# Enables branch-specific sitechef config files | |
# my moving data.json and .sitechef/.conf to subdirectories | |
# named after the branch name | |
# | |
# Installation | |
# Copy this file to your .git/hooks/ folder | |
###### | |
set -e | |
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
echo "After Checkout" | |
prevBranch=`git reflog | awk 'NR==1{ print $6; exit }'` | |
newBranch=`git reflog | awk 'NR==1{ print $8; exit }'` | |
echo "copy old files to $prevBranch" | |
cd "$scriptdir/../../.sitechef/" | |
mkdir "$prevBranch" || true | |
mkdir "$newBranch" || true | |
cp data.json "$prevBranch/" | |
cp .conf "$prevBranch/" | |
echo "copying new files to $newBranch" | |
cp "$newBranch/data.json" ./ | |
cp "$newBranch/.conf" ./ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment