Skip to content

Instantly share code, notes, and snippets.

@ardbytes
Created August 13, 2011 09:45
Show Gist options
  • Save ardbytes/1143695 to your computer and use it in GitHub Desktop.
Save ardbytes/1143695 to your computer and use it in GitHub Desktop.
#!/usr/bin/zsh
# post-checkout hook to adjust heroku.remote based on the branch being checked out.
#
# Do nothing on file checkout
[[ $3 -eq 0 ]] && exit
echo "Fixing heroku.remote"
current_branch=$(git symbolic-ref HEAD)
# production is a local branch tracking remote branch production/master. Likewise with staging.
[[ "refs/heads/production" == $current_branch ]] && git config heroku.remote production && exit
[[ "refs/heads/staging" == $current_branch ]] && git config heroku.remote staging && exit
git config --unset heroku.remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment