error: cannot pull with rebase: You have unstaged changes. means you asked Git to rebase your branch onto the remote while a tracked file has edits that are not committed. A rebase rewrites the working folder, so Git refuses. Run git pull --rebase --autostash, which tucks the edits away and puts them back afterwards, or commit or stash them yourself first.

Nothing was lost and nothing was pulled: the refusal happens before Git touches your branch. A plain git rebase refuses for the same reason with the wording cannot rebase.

The error

PS> git status --short
 M notes.txt

PS> git pull --rebase
error: cannot pull with rebase: You have unstaged changes.
error: Please commit or stash them.

The rebase variant, in the same repository:

PS> git rebase origin/main
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.

Why it happens

git pull --rebase fetches and then rebases: it sets your branch aside, moves to the remote commit and replays your local commits on top, one by one. Each of those steps rewrites files in the working folder. If notes.txt has edits that live only in the folder, a step that touches the file would overwrite them, so Git checks for a clean working tree before it starts and stops if it is not.

The leading space in M notes.txt from git status --short is the clue: a modified file that is not staged.

The fix

PS> git pull --rebase --autostash
From C:/.../b-remote
   0599a0f..4e782c0  main       -> origin/main
Updating 0599a0f..4e782c0
Created autostash: aa8b8e2
Fast-forward
 price.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Applied autostash.
PS> git status --short
 M notes.txt

--autostash creates a temporary stash, runs the pull, and applies the stash again: the output says "Created autostash" and "Applied autostash", and git status afterwards shows your edit still in place on top of the new commit. Your other options are to commit the work first (then it is rebased with the rest) or to stash the edit yourself, pull, and bring it back; the autostash does exactly that in one command.

How it was reproduced

Git for Windows 2.45.2 on Windows 11, Windows PowerShell 5.1. A local bare repository served as the remote, with two clones (David Chen and Maria Garcia, fictional). David pushed a change to price.txt; Maria had an uncommitted edit to notes.txt. git pull --rebase exited with 128 and git rebase origin/main with 1. git pull --rebase --autostash brought in David's commit and kept Maria's edit.

Frequently asked

How do I pull with rebase when I have unstaged changes?
Run git pull --rebase --autostash. Git stashes the changes, rebases onto the remote and applies the stash again. Or commit or stash the changes yourself before pulling.
Does cannot pull with rebase lose my changes?
No. Git refuses before it changes anything, so your edits and your branch are exactly as they were.
What is the difference between cannot pull with rebase and cannot rebase?
The cause is the same: uncommitted edits to tracked files. git pull --rebase prints cannot pull with rebase, a plain git rebase prints cannot rebase. Commit or stash, then run it again.

More decoded errors in the Fixes category. If a plain merge-style pull refuses for the same reason, see Your local changes would be overwritten by merge.