Skip to content

Instantly share code, notes, and snippets.

@8parth
Created May 7, 2018 05:48
Show Gist options
  • Select an option

  • Save 8parth/6df54db2bf931b4b2e61ecd3922cae69 to your computer and use it in GitHub Desktop.

Select an option

Save 8parth/6df54db2bf931b4b2e61ecd3922cae69 to your computer and use it in GitHub Desktop.
git and heroku helper scripts
#!/bin/sh
cd $PWD
echo $1
if [ -d .git ]; then
if [ -z "$1" ]; then
echo "checking out $(git symbolic-ref --short -q HEAD) ..."
else
echo "Checkout to $1 ..."
git fetch && git checkout $1
fi;
current_branch="$(git symbolic-ref --short -q HEAD)"
echo "Current Branch is [ $current_branch ]"
if [ $current_branch = 'develop' ]; then
echo "on develop branch"
else
echo $current_branch
echo "checkout develop"
git checkout develop
git pull origin develop
echo "delete $current_branch"
git branch -d $current_branch
git push origin --delete $current_branch
fi;
else
echo "Not a git directory"
fi;
#!/bin/sh
cd $PWD
git checkout develop
git pull origin develop
git push heroku develop:master
heroku run rails db:migrate -r heroku
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment