Clean git repo on Heroku

Paul picture Paul · May 4, 2012 · Viewed 44.5k times · Source

The situation is as follows:

We have some project which persists on Github, and deploy it to Heroku, which has its own mini-Git. Some changes were applied directly to Heroku (cloned repository from Heroku, made changes and pushed). In a meanwhile the master branch on Github has gained also some changes.

Now when I want to push the main repository to Heroku, pushing fails because commits on Heroku are out of sync with local commits.

I do not want to merge with changes on Heroku - I just want them to vanish.

Is there some way to clean git repository on Heroku to push then my local repo from the very beginning?

I do not want to destroy application and recreate it again because it has some paid services and I am just an collaborator.

Answer

Jon Mountjoy picture Jon Mountjoy · May 4, 2012

You can just use the -f flag in git (it's a standard git flag) to force the push. See the side note in the Dev Center Git doc. This will overwrite those changes you've made on Heroku obviously.