ProjectStack
git

error: cannot rebase: you have unstaged changes

Git won't start a rebase because you have modified files that haven't been staged or committed. Rebase needs a clean working tree to apply commits safely.

Common causes

  • You edited files and didn't commit or stash before rebasing
  • An editor or IDE auto-saved changes that show up as modifications
  • Files were modified by a previous command and left uncommitted
  • You're trying to rebase in the middle of other in-progress work

How to fix it

  1. Commit your work first: git add . && git commit -m 'WIP'
  2. Or stash and unstash: git stash, then git rebase <target>, then git stash pop
  3. Check what's modified: git status
  4. To discard changes if they don't matter: git checkout -- .

Example

error: cannot rebase: you have unstaged changes error: Please commit or stash them.

Running git rebase main with unsaved edits in the working tree

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.