How to fix "Updates were rejected because the tip of your current branch is behind"
Tested: we reproduced this error and confirmed the fix on Ubuntu 24.04 with Git 2.43.0, November 29, 2026.
The remote branch has commits that your local branch doesn’t, so Git won’t overwrite them. Get those commits first, then push:
git pull --rebase
git push
In our test with Git 2.43, a second clone pushed a commit first. The next push from the first clone was rejected, git pull --rebase replayed the local commit on top, and the push then went through.
What non-fast-forward means
A push is a fast-forward when the remote branch can simply move ahead to your latest commit, because your history already contains everything on it. If the remote has a commit you don’t have, moving it to your commit would throw that commit away, so Git calls the push non-fast-forward and refuses. Getting the remote’s commits into your branch makes the push a fast-forward again.
To see what you’re missing before you pull:
git fetch
git log --oneline HEAD..origin/main
In our test that listed the one commit the other clone had pushed.
Which message you have
Git words the rejection two ways:
| Message | Meaning |
|---|---|
Updates were rejected because the remote contains work that you do not have locally |
Someone pushed since you last fetched. You haven’t seen their commits yet |
Updates were rejected because the tip of your current branch is behind its remote counterpart |
You’ve fetched them, and your branch is behind or has split from the remote |
Both lines come with ! [rejected] main -> main (non-fast-forward) or (fetch first). The fix is the same: bring in the remote commits, then push.
Fix: someone else pushed first
git pull --rebase # or: git pull --no-rebase to merge instead
git push
If the pull stops with fatal: Not possible to fast-forward, aborting., your Git is set to only fast-forward (pull.ff=only or --ff-only), and your branch and the remote have both moved. We saw this in our test with one new commit on each side. Use git pull --rebase or git pull --no-rebase for this pull, as above.
If the pull stops with a conflict, open the files it lists, keep the right lines, then:
git add <file>
git rebase --continue
git push
git rebase --abort takes you back to where you started if you’d rather not continue.
Fix: you rewrote commits you’d already pushed
After git commit --amend, git rebase -i or a reset, your history no longer matches the remote’s. We amended a pushed commit and the push was rejected as non-fast-forward. On a branch only you use:
git push --force-with-lease
That replaced the remote branch in our test. --force-with-lease checks the remote is still where you last saw it, so it won’t silently delete commits someone else pushed in the meantime. Plain --force doesn’t check.
Fix: it’s a protected branch
If the push is rejected with protected branch or GH006, the host blocks direct pushes to that branch (we didn’t reproduce this one; it depends on the host’s settings). Push to a new branch and open a pull request instead:
git switch -c my-change
git push -u origin my-change
Confirm it worked
The push prints a line ending in main -> main with no [rejected], and git status says Your branch is up to date with 'origin/main'. If the remote branch has a completely separate history, you’ll see refusing to merge unrelated histories when you pull.
FAQ
When is git push --force safe?
When the branch is yours alone, for example a feature branch nobody else has pulled. Use git push --force-with-lease, which refuses if the remote has commits you haven't fetched. Never force push a shared main branch.
Should I pull with merge or rebase?
Rebase keeps a straight history and is the usual choice for your own unpushed commits. Merge is safer if you're unsure, because it never rewrites commits. Set your default with git config --global pull.rebase true or false.
Why do I get this after amending a commit?
Amending a commit you already pushed creates a new commit, so your branch and the remote have split. If nobody else uses the branch, git push --force-with-lease is the fix.
