Pushing changes with git to Heroku without triggering a buildpack.

Heroku offers a buildpack service which enables admins to deploy the Python environment, install packages with pip, and assemble the slug. A buildpack is triggered whenever a commit from master is pushed to Heroku. For those who might be familiar with Django but not with Heroku, here on pastebin is the full output showing the buildpack in action.

The problem is, even if I make a trivial change, pushing master to Heroku builds from source which I feel is usually completely unnecessary. Perhaps after making many major commits, deploying using a build pack is a good idea. But most of the time, I just want to push small source code changes.

For anyone who is familiar with deploying Django with Heroku, how do I push my changes without triggering the buildpack every time?

I’ve tried variations of git push parameters such as:

  • (local venv) $ git push heroku
  • (local venv) $ git push heroku master
  • (local venv) $ git push heroku origin/master

The first two build. When I run the last one there in the shell for my development environment, git returns this output, verbatim:

(local venv) $ git push heroku origin/master
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 649 bytes | 649.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Pushed to branch other than [main, master], skipping build.
To ssh://heroku.com/<project-name>.git
 * [new reference]   origin/master -> origin/master
(local venv) $

So that looks like the buildpack is not running, right? However, when I peak at the Heroku dashboard, in the logs, I can see the buildpack running in the background. So $ git push heroku origin/master runs the buildpack silently locally.

I really just want to be able to push a change and test it instantly without having to wait 2 minutes for the slug to assemble. Is my only option to disable the buildpack altogether?

I’ve used Google search terms such as:

  • ‘push changes to heroku without buildpack’
  • ‘push heroku no buildpack’
  • ‘heroku buildpack silent’ # which turns up only 93 search results
  • ‘heroku buildpack “silent”’ # which turns up 497,000 search results

All those search results are not relevant to my question. I am getting nowhere with Google.

AFAIK you can’t skip buildpacks. Buildpacks transform your project source code into something runnable by Heroku called slug.

From Heroku docs:

Slugs are compressed and pre-packaged copies of your application optimized for distribution to the dyno manager. When you git push to Heroku, your code is received by the slug compiler which transforms your repository into a slug. Scaling an application then downloads and expands the slug to a dyno for execution.

That said, you can create your own slugs.