We are pushing builds to heroku and would like to push without pulling in latest changes. I am essentially using the github repo as my source control repository and pushing to the git heroku repo from several different machines. Since we have a few build servers pushing to the same heroku repository sometimes a push of latest bits from a build server will throw a message saying I need to pull latest before committing and pushing.
However since the code from the build server is guaranteed to be the latest, I'd like to throw away the changes from the pull and just commit and push the files without a merge.
Is there a way to do this? Any other suggestions on how best to set this up?
Git prevents you from overwriting the central repository's history by refusing push requests when they result in a non-fast-forward merge. So, if the remote history has diverged from your history, you need to pull the remote branch and merge it into your local one, then try pushing again.
Just like git push --force allows overwriting remote branches, git fetch --force (or git pull --force ) allows overwriting local branches.
Just do git push -f
( force push )
Pushing to heroku might be one of the valid use cases for git push -f
, but still be careful and understand what you are doing.
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