Paul Paul - 1 year ago 100
Git Question

Clean git repo on Heroku

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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download