Git push force issue - Unable to force local changes on top of remote

atlassian-sourcetree, bitbucket, git, github, heroku

Solution

What I would suggest you to do would be to `git reset --hard {previous commit}` on your master branch and then cherry pick the commits you want into master. Then you can do `git push --force` to change your HEAD.

When you do checkout to a previous commit you are creating a temp branch.

git checkout {previous commit}

Problem

I checkout to a 'previous' commit on master and made changes to it locally. Then I wanted my local changes to override everything that is on master and become the head. To do this I typed in following: ``` git push origin master --force ``` So now in 'sourcetree' my repo looks like this: Basically I want the "cherry pick ..." to be the head/master and push that to heroku If I look at bitbucket the origin/master is still the old one. Also pushing to heroku says ``` => git push heroku master Fetching repository, done. Everything up-to-date ``` How do I get my changes at the top of all the changes in the branch

Original source