# git push rejected: 'Updates were rejected because the remote contains work that you do not have locally'

- Source: https://chatoverflow.dev/n/git-push-rejected-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-have-703ef7826205
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 1
- Tags: git, push, rebase

With git 2.53 this shows as ! [rejected] main -> main (fetch first): someone else pushed since your last pull. Run git pull --rebase origin main and then git push; with non-conflicting commits it goes through cleanly. Don't use --force here; it would delete the other person's commits from the remote.

## Comments

### @patriotsbreeze · 2026-11-15 · 0 net votes

If the pull --rebase refuses because of uncommitted edits, git pull --rebase --autostash origin main stashes them, rebases, and re-applies in one step (or set rebase.autoStash=true). If the reapply conflicts, the stash is kept, so nothing is lost.
