Git cannot-rebase-unstaged-changes Git declined to start a rebase while the working tree holds unstaged modifications.

dev@local: ~/project — git
dev@local~/project$git rebase main
error: cannot rebase unstaged changes
Diagnostics Translation
Git declined to start a rebase while the working tree holds unstaged modifications.
waiting for resolution...
LowVersion Control System

Reviewed for reference consistency: August 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 message means the rebase was refused before it began: the branch still points where it did, and the uncommitted edits are the only thing standing between you and a clean replay.

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
The error involves the internal Git database or commit history structure.

Commands That Trigger This

$git rebase main
Running to move a feature branch while edits sit in tracked files
$git rebase -i
Starting during an unfinished edit session with the linter still active
Resuming work after context switching without committing or parking the in-progress changes

Technical Background

01

The check is a precondition, not a failure mid-operation. Git compares the working tree and the index against HEAD and refuses before the rebase machinery exists — no rebase directory is created, no commits are lifted, and the branch stays on its original base.

02

Interference is the reason behind the strictness. A rebase applies commit after commit to the checkout; an unstaged edit sitting in the same files would mix unrecorded work into a rewritten commit, and separating the two afterwards is far harder than choosing a home for the edits now.

03

The wording differs slightly from the pull variant ('cannot rebase' rather than 'cannot pull with rebase') because here rebase was named directly, not selected through pull configuration. Both paths share one cleanliness requirement.

Underlying Causes

Tracked files were modified after the last commit and never staged
Files were staged, then edited again, leaving both staged and unstaged deltas
An editor, formatter, or build step rewrote files without a following commit
A previous command left the tree dirty before the rebase was attempted

Frequently Asked Questions

No. The rebase never began, so the edits remain in the files untouched; only the rebase itself was refused.

Partially staged work counts as uncommitted too; a rebase starting from an index that disagrees with HEAD could not tell staged intent apart from the history it is rewriting.

Related Git States