1

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.

4

1 回答 1

2

我不熟悉 Heroku,但您可以轻松编写一个 shell 脚本包装器:

  • 使用获取当前分支的名称git symbolic-ref --short HEAD
  • 通过使用获取 Heroku 目标git config heroku.<branch>.remote
  • 运行相应的命令

这假设您为 heroku 手动配置每个分支设置,例如:

git config heroku.master.remote production
git config heroku.develop.remote staging

这本身不会做任何事情。它只是让您在脚本中使用git config.

于 2012-08-13T17:33:07.477 回答