Is it possible to to target an app version in Heroku based on the current Git branch? In the Heroku docs, its specifies how to target a a specific version of the app.
# run command on 'production'
$ heroku run rake db:migrate --remote production
To make things easier, you can use your git config to specify a
default app. For example, if you wanted “staging” do be your default
remote, you could set it with the following command:
$ git config heroku.remote staging
It would make sense to have the local development branch push to the development app and the local production branch push to the production app.
I’m not familiar with Heroku, but you could easily write a shell-script wrapper that would:
git symbolic-ref --short HEADgit config heroku.<branch>.remoteThis assumes that you manually configure a per-branch setting for heroku, e.g.:
This doesn’t do anything by itself; it’s just lets you read these values in a script using
git config.