Heroku: how to "git pull" after 'git push -f' Heroku: how to "git pull" after 'git push -f' heroku heroku

Heroku: how to "git pull" after 'git push -f'


Forcing your git push was not a good idea because you lost any commit that was done by you or other collaborators you were missing on your working copy.

Before pushing, you should have either merged or rebased the upstream changes into your local working copy.

To merge the changes locally

$ git pull heroku master$ git push heroku master

To rebase the changes locally

$ git pull --rebase heroku master$ git push heroku master

BTW, now that you have pushed your changes, you actually don't need to do anything else. The remote repository already contains all your changes.

If for whatever reason the $ git status command is returning outdated references, simply run

$ git pull heroku

to fetch all the remote changes. Please note that unless you specify a target branch (or you have the tracking branch enabled), git pull will simply download (and not merge) the upstream changes.

Also note that Heroku should not be considered a git hosting. It means that it's extremely uncommon to perform a git pull from Heroku. Instead, you should use a git hosting (such as GitHub or BitBucket) to store your repository and only perform push to Heroku to deploy the application.


That error basically means that there is code in the repo that is newer than the code you're trying to push to it.

you have to do a pull and update your own working repository then push again, or just force a push

git pull heroku master

As a side note, if you aren't familiar with all the git commands, I would recommend you use a GUI as it may make the whole process a lot less overwhelming.

There are plenty of great clients here: http://git-scm.com/downloads/guis