Follow

Deploying a branch that’s not called `master` to Heroku (or pushing to a different branch name on remote in general)? Remembering to prefix the remote’s branch name with the local one might save you some confusion.

$ git push heroku my_branch:master

Where `heroku` is the remote, `my_branch` is the local branch name, and `master` is the remote branch name. Hopefully, I’ll get it right on the first try too, one day.

@jkreeftmeijer I tend to do: `git push heroku HEAD:master`, which deployed the current branch I'm on.

@jkreeftmeijer And I remember it because deleting a remote branch is `git push origin :some-branch`, so override some-branch with nothing, deletes it. Such simple

@pjaspers Yes, it does make a lot of sense. I know how to push to a differently named branch, but it takes me a while to connect the dots, specifically when pushing to Heroku. 🤷

@jkreeftmeijer I only remember it because the delete a branch is such a programmer solution. It makes sense but it's not for humans :)

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!