Skip to content

Instantly share code, notes, and snippets.

@btwelch
Created January 23, 2015 16:15
Show Gist options
  • Save btwelch/ec2cf4021cda1bd17223 to your computer and use it in GitHub Desktop.
Save btwelch/ec2cf4021cda1bd17223 to your computer and use it in GitHub Desktop.
Rails git-flow shell script for easy branching
#
# Usage:
#
# ./makesandwich.sh branch_name
#
#
# makesandwich.sh
#
echo "Changing to the home directory...";
cd YOUR_BRANCH_DIR_PATH;
echo "Creating new directory for our branch: $1...";
mkdir $1;
echo "Changing to the new directory...";
cd $1;
echo "Cloning the dev branch...";
git clone [email protected]:YOUR_PROFILE_URL/YOUR_GIT_REPO.git;
echo "Changing to the working directory (the folder that was just copied from git)...";
cd YOUR_WORKING_DIRECTORY_NAME;
echo "Creating new local git branch: $1...";
git checkout -b $1;
echo "Pushing new branch to remote (creates it in github)...";
git push origin $1;
#
# Any other config setup, incl. copying database example yaml, et al.
#
echo "Running rake db:setup...";
rake db:setup;
echo "Starting the default Rails webserver (Webrick)...";
rails server;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment