Recompile Heroku slug without push or config change

The simplest workaround for now is to push an empty commit.

git commit --allow-empty -m "empty commit"
git push heroku master

Slug compilation is invoked with a git pre-recieve hook, so the only way to recompile is to push a new commit.

For completeness see this article on Heroku for the slug compiler. It discussed the use of the pre-recieve hook to invoke the slug compile process under the Compilation heading.


My general approach is to do:

git commit --amend -C HEAD
git push heroku master -f

Not sure I'd do this in production without being certain, as it does technically rewrite the last commit but it shouldn't cause any issues in theory. It's perfectly fine for when you are testing things in staging though.

As an added bonus since most people are problem using Vim to edit commit messages SHIFT-ZZ will quickly save and exit the commit message for you without making any changes to it.

On a related note I'm mildly shocked Heroku still doesn't have this feature. I've often seen Heroku fail to deploy due to problems on their end.

Thanks to Michael Mior for the idea to use -C HEAD to avoid opening up an editor.


Heroku have release a plugin that what is asked: https://github.com/heroku/heroku-repo

To install it:

$ heroku plugins:install heroku-repo

To force a rebuild:

$ heroku repo:purge_cache -a appname
$ heroku repo:reset -a appname
$ git push heroku