I am having a problem pushing to a different heroku remote.
To check myself I renamed my entire project directory to _backup and then:
git clone account/repo_name
git remote add repo2 git@heroku.com:repo2.git
git push repo2 branch_abc:master
But I am still getting
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I have tried several SO questions and answers but not worked for me, still getting the error regardless.
If you don’t care about what’s currently in repo2 and are confident that totally overwriting it is ok then you can use:
Remember though that
push -fcan wipe out other developers changes if they were posted since you last pulled from the repo… so always use with extreme caution on multi-developer teams!In this case heroku is always downstream and github is where the code is managed and maintained so this makes
push -fon heroku a safer option that it would otherwise be.