What does “Git push non-fast-forward updates were rejected” mean?

GitHub has a nice section called “Dealing with “non-fast-forward” errors

This error can be a bit overwhelming at first, do not fear.
Simply put, git cannot make the change on the remote without losing commits, so it refuses the push.
Usually this is caused by another user pushing to the same branch. You can remedy this by fetching and merging the remote branch, or using pull to perform both at once.

In other cases this error is a result of destructive changes made locally by using commands like git commit --amend or git rebase.
While you can override the remote by adding --force to the push command, you should only do so if you are absolutely certain this is what you want to do.
Force-pushes can cause issues for other users that have fetched the remote branch, and is considered bad practice. When in doubt, don’t force-push.

Git cannot make changes on the remote like a fast-forward merge, which a Visual Git Reference illustrates like:

This is not exactly your case, but helps to see what “fast-forward” is (where the HEAD of a branch is simply moved to a new more recent commit).

The “branch master->master (non-fast-forward) Already-up-to-date” is usually for local branches which don’t track their remote counter-part.
See for instance this SO question “git pull says up-to-date but git push rejects non-fast forward“.
Or the two branches are connected, but in disagreement with their respective history:
See “Never-ending GIT story – what am I doing wrong here?

This means that your subversion branch and your remote git master branch do not agree on something.
Some change was pushed/committed to one that is not in the other.
Fire up gitk --all, and it should give you a clue as to what went wrong – look for “forks” in the history.

Leave a Comment