I cleaned up my commit history yesterday because there was some private information that had accidentally been pushed. After cleaning my commits, I force pushed to my master branch. Everything is the same both on my computer and in my repo. However, when I try to push to Heroku I get this error:
Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g.'git pull ...') before pushing again.
So I have been looking through similar threads and have tried:
$ git pull origin master and git pull --rebase origin master
which returns:
* branch master -> FETCH_HEAD
Already up-to-date.
I have also tried git fetch which returns the same response. It says everything is up to date, so why can't I push to heroku? Does this have to do with the git filter-branch I ran yesterday, and how do I fix it?
Git is designed in such a way that it will prevent you from overwriting any branches that have already been pushed to a remote. Your git filter-branch is one of many ways of rewriting a branch's history (you got that part straight in your question).
The --force option on git push lets you update a remote branch regardless of any divergences in history.
Note that technically your private information is not guaranteed to be completely deleted.
dangling commitsgit gc over there.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With