ProjectStack
git

error: failed to push some refs (non-fast-forward)

Your local branch is behind the remote branch — the remote has commits that your local branch doesn't include. Git won't overwrite those remote commits with a normal push.

Common causes

  • Another developer pushed to the same branch after you last pulled
  • You rebased locally and your history diverged from the remote
  • CI or a bot made a commit to the branch on the remote
  • You're pushing from a different machine that doesn't have the latest commits

How to fix it

  1. Pull the latest changes and integrate: git pull --rebase origin <branch>
  2. Or merge: git pull origin <branch>, then push again
  3. Use --force-with-lease as a safer force push (won't overwrite others' work): git push --force-with-lease
  4. Never use --force on shared branches like main — it will overwrite others' work

Example

error: failed to push some refs to 'origin' hint: Updates were rejected because the tip of your current branch is behind its remote counterpart.

Pushing after another team member committed to the same branch

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.