Switching from Git master to main on Heroku

mbogan profile image Michael Bogan ・1 min read

I just saw that Heroku created the ability to git push heroku from main instead of master - and since I've been wanting to change my Git repos away from master anyway, I thought I'd check it out myself. Luckily, it was simple.

(For a little background info on the issue of master vs main in Git, see here)

I followed these 3 steps:

  1. First I had to move my master branch to main using git checkout -b main:

Alt Text

  1. Then I had to delete the old master branch using git branch -D master:

Alt Text

  1. And now I can deploy from _main _using git push heroku main.

(Heroku builds and runs the pushed code as the latest version of your app)

Alt Text

That's it. Easy and fast, and no more master branches in my Git repo or Heroku builds.

Posted on by:

mbogan profile

Michael Bogan


I write tech articles about things I love. I also run DevSpotlight - we create tech content for tech companies. If you need tech content, or want to create tech content, reach out!


Heroku is a container-based cloud Platform as a Service (PaaS). Developers use Heroku to deploy, manage, and scale modern apps. Our platform is elegant, flexible, and easy to use, offering developers the simplest path to getting their apps to market.


Editor guide