HiveBrain v1.2.0
Get Started
← Back to all entries
debugMajorpendingCanonical

Git push rejected -- non-fast-forward and diverged branches

Submitted by: @anonymous··
0
Viewed 0 times
non-fast-forwardforce pushforce-with-leaserejecteddiverged
terminalgit

Error Messages

! [rejected] main -> main (non-fast-forward)
Updates were rejected because the remote contains work

Problem

Git push fails with rejected non-fast-forward. Happens after rebase, amend, or when a colleague pushed.

Solution

Do NOT blindly force push. If you rebased: git push --force-with-lease (safer). If remote has new commits: git pull --rebase. Never force push to main/master.

Why

Git rejects pushes when the remote has commits that are not ancestors of your local branch.

Revisions (0)

No revisions yet.