以下のコマンドでstagingをデフォルトのherokuリモートにする。
$ git config heroku.remote staging
.git/configファイルに以下が追記される。
[heroku] remote = staging
この記載がされることで、CLIコマンドがデフォルトでstagingアプリを管理するようになる。
以下のようにremoteを追加されていれば、
$ heroku git:remote -a アプリ名(staging) $ heroku git:remote -r production -a アプリ名(production)
.git/configファイルは以下のようになる。
[heroku] remote = staging [remote "staging"] url = https://git.heroku.com/アプリ名-staging.git fetch = +refs/heads/*:refs/remotes/staging/* [remote "production"] url = https://git.heroku.com/アプリ名.git fetch = +refs/heads/*:refs/remotes/production/*
上記という前提があると、以下のコマンドを実行することで、productionアプリに対して実行ができる。
$ heroku logs -t -r production