重新部署Heroku应用程序,无需更改代码 [英] Redeploy Heroku app without code changes
问题描述
我想部署一个Heroku应用程序,使用 git push -u heroku master
完成理想的应用程序。但是,只有在有任何未完成的提交被推送给主设备时,这才会有效。
I would like to deploy a Heroku app which will be done ideally using git push -u heroku master
. However this will only work if there are any pending commits to be pushed to master.
如何在无需推送的情况下重新部署应用程序?我尝试了 git push -u heroku master -f
,并且仍然如下所示
How can I redeploy the app while there is nothing to push ? I tried git push -u heroku master -f
and still get the same below
Branch master set up to track remote branch master from heroku.
Everything up-to-date
PS:我也想保留现有的应用程序,这意味着我无法使用此答案 https://stackoverflow.com/a/22043184/968442
PS: I also want to retain the existing app, which means I cannot make use of this answer https://stackoverflow.com/a/22043184/968442
推荐答案
正常情况下,设置一个配置变量会导致应用程序重新启动。在大多数情况下,执行此操作后不需要重新部署。
Normally setting a config var causes your application to be restarted. In most situations there should be no need to redeploy after doing this.
如果确实需要触发新部署,则可以添加新的空提交,然后按Heroku再次:
If you really do need to trigger a new deployment you can add a new empty commit, then push to Heroku again:
git commit --allow-empty -m "Trigger Heroku deploy after enabling collectstatic"
git push heroku master
新的空提交是常规提交。它有一个散列,一个作者,一个时间戳等等。它将和它的父代有相同的树。这应该会导致Heroku再次使用与之前提交相同的代码来构建您的应用程序slug。
The new empty commit is a regular commit. It has a hash, an author, a timestamp, etc. It will have the same tree as its parent. This should cause Heroku to build your app slug again using the same code as the previous commit.
这有点尴尬,但它有效。
It's a bit awkward, but it works.
这篇关于重新部署Heroku应用程序,无需更改代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!