Git issue (X commits ahead)

When X commits ahead on origin/master:

git diff upstream/master    # should output nothing; this checks that the next command won’t throw anything away

git reset –hard upstream/master    # note upstream/master, not origin/master

Now your master is identical to upstream/master. You can push it to origin:

git push origin

…but that will fail, because the branches have diverged, so you’ll need to do

git push –force origin

Simple instructions…

git fetch upstream

git checkout master

git reset –hard upstream/master 

git push origin master –force