I have a Heroku app that has not worked for the last 3 or 4 commits. My site ran fine locally, but I had to push changes in order to see if it would run on Heroku - I have yet to be able to get it to work, so I would like to be able to git rid of the last several commits, both locally and on Heroku.
My attempts at doing this from the terminal and Source Tree have caused a pretty big mess. And while I have been able to rollback my local copy, pushing changes after the rollback get me this error:
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.
How can I remove these commits in both places?
-
Did you revert your changes, or rebase and deleted the commits?Schleis– Schleis2013年08月22日 20:05:24 +00:00Commented Aug 22, 2013 at 20:05
1 Answer 1
I assume by "rollback", you mean you used git reset --hard. In that case, use git push -f to confirm that you really do want to delete those commits from the server. (Keep in mind that you're rewriting history, which is why you need the -f option.)