Table of Contents [expand]
Deploying the same version of your application multiple times can indicate that you’re pushing code to Heroku incorrectly. This article explains how these duplicate deploys with the same code version are possible and how to diagnose and fix the issue.
Diagnosing Uncommitted Local Files
Verify that you committed all of your local changes.
$ git status
On branch main
nothing to commit, working tree clean
If you don’t see “nothing to commit,” you must check in your code changes. Run this command to add them all.
$ git add -A
$ git commit -m "code"
Run git status
again to verify that there’s nothing left to commit. Deploy to Heroku.
Diagnosing Deploys from a Different Branch
Ensure that you’re looking at the main
branch when pushing:
$ git branch --show-current
main
Following changes in the industry, Heroku updated the default Git branch name to main
. If the project you’re deploying uses master
as its default branch name, use git push heroku master
.
If this shows that you’re on a branch other than main
, you must specify an explicit branch name to push it to the Heroku remote:
$ git push heroku <current branch name>:main
For example, if you’re currently developing on a branch called my_staging_branch
and you want to push that to main
on the Heroku remote, use this command.
$ git push heroku my_staging_branch:main
Otherwise, this command:
$ git push heroku main
Is synonymous with this command:
$ git push heroku main:main
By default, git
will push the main
branch when you git push <remote> main
, even if you have a different branch name checked out. To correct the issue, push using an explicit branch name:
$ git push heroku <current branch name>:main