Created
August 26, 2013 09:41
-
-
Save remino/6339739 to your computer and use it in GitHub Desktop.
git-deploy: Script to push branches to different Heroku environments.
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/sh | |
# git-deploy | |
# | |
# - Make sure your deployment environments on Heroku are set as Git remotes: | |
# git remote add production [email protected]:example-production.git | |
# git remote add staging [email protected]:example-staging.git | |
# | |
# - Have branch names matching those environments: | |
# git checkout -b production | |
# git push origin production | |
# git checkout -b staging | |
# git push origin staging | |
# | |
# - Call git deploy branch_name: | |
# It will call "git push branch_name branch_name:master" to deploy your app. | |
git_deploy() { | |
[ $# -lt 1 ] && git_deploy_usage && return 1 | |
git push $1 $1:master | |
} | |
git_deploy_usage() { | |
echo "usage: git deploy [branch_name]" | |
echo | |
echo "The branch_name must match the Git remote name for Heroku." | |
} | |
git_deploy $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment