git branches diverged after rebase

I have followed this answer (How to remove/delete a large file from commit history in Git repository?) to get rid of some big, unwanted files in a repository. I have done all the steps stated there in my local copy (because trying to do it in the bare, original, repository results in an error as long as it does not have a working tree). Nevertheless, when I finish the steps (having removed the files, etc.) and I do a “git status” on my local copy, I get

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 16 and 18 different commit(s) each, respectively.

and I do not know how to send the changes back to the central repository. Can anybody help me?

  • Git push rejected “non-fast-forward”
  • How do I interactively rebase a git topic branch in isolation without counting commits?
  • Remove committer information from git commits
  • How to git commit --amend a commit that's the base of a branch
  • Git sync changes with remote master
  • `git branch --list` returns files?
  • Git: continuous integration without rebase chaos
  • Git commits are duplicated in the same branch after doing a rebase
  • One Solution collect form web for “git branches diverged after rebase”

    Since you have change the history of your commits, you would have to force push them back to origin:

    git push --force
    

    This is dangerous and disruptive. Make sure to communicate that event (before pushing) to anyone having already pulled from your repo: they will need to reset their master branch to the one you just pushed:

    git checkout master
    git fetch
    git reset --hard origin/master
    
    Git Baby is a git and github fan, let's start git clone.