{{announcement.body}}
{{announcement.title}}

Changing from Git Master to Main on Heroku

DZone 's Guide to

Changing from Git Master to Main on Heroku

Follow along with Michael, one of our core members as he walks through a quick tutorial on how to change git master to git main on Heroku.

· DevOps Zone ·
Free Resource

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:

 

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

 

3. 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)

 

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

Topics:
devops, git, github, heroku, main, master, repositories

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}