I got this error message (copied below) after trying to push to Heroku. I initially set up a facebook canvas app and selected the hosting on heroku options. It gave me a heroku url, which I added as a remote on the app I was developing on my machine
heroku git:remote -a desolate-springs-1684
But when I pushed, I got this error
error: failed to push some refs to 'git@heroku.com:desolate-springs-1684.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
localhost:nhl michaelmitchell$
So I did
git push -f heroku master
But now I apparently have to do a ‘git pull’. However, what do i put after the ‘git pull’? The name of the heroku url? or something else?
Forcing your
git pushwas 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
To rebase the changes locally
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 statuscommand is returning outdated references, simply runto fetch all the remote changes. Please note that unless you specify a target branch (or you have the tracking branch enabled),
git pullwill 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 pullfrom 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.