dev@local: ~/project — git
dev@local~/project$git push
To github.com:developer/project.git
! [rejected] main -> main (fetch first)
error: non fast forward
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
Diagnostics Translation
Git rejected your push because your branch is behind the remote, preventing a linear update.
waiting for resolution...
MediumVersion Control System

Reviewed for reference consistency: April 11, 2026

Code is Safe

SECURE

Git has paused the operation to protect your code. No data has been lost or corrupted.

What To Know

This rejection means the remote branch moved along a history path your local branch does not fully contain, so Git will not replace it with a shorter line.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
Git halted to protect the uncommitted files in your active working directory.

Commands That Trigger This

$git push
Running when `git status` shows your branch and the remote have diverged
$git push
Using after successfully running `git rebase`

Technical Background

01

When histories diverge, Git requires a merge or rebase to reconcile the differences.

02

The non-fast-forward rule protects the central repository from losing commits. If Git allowed the push, the remote pointer would move to your commit, effectively 'forgetting' the other commits.

Underlying Causes

Trying to push to a branch that has new remote commits
Rewriting local history (e.g., using `git commit --amend`) and trying to push over the old history
Resetting a branch locally and attempting to sync it with a remote

Frequently Asked Questions

It means the remote branch can be updated simply by moving its pointer forward to your new commit, without needing a merge commit, because the histories have not diverged.

Related Git States