この内容は古いバージョンです。最新バージョンを表示するには、戻るボタンを押してください。
バージョン:2
ページ更新者:atom
更新日時:2026-05-12 10:51:51

タイトル: Cannot rebase: You have unstaged changes. Please commit or stash them.
SEOタイトル: Cannot rebase: You have unstaged changes. の原因と対処法

Cannot rebase: You have unstaged changes. Please commit or stash them. は、作業ツリーに未整理の変更がある状態で git rebase しようとしたときに出ます。

リベースは履歴を並べ直す操作なので、途中で混ざらないように、まず変更を整理する必要があります。

エラー内容

Cannot rebase: You have unstaged changes. Please commit or stash them.

発生条件 / 原因

  • 未ステージの変更が残っている
  • ステージ済みだが未コミットの変更がある
  • 環境設定ファイルなどを一時的に編集したままになっている

対処法

不要でなければ、いったん stash で退避してからリベースします。

git stash
git rebase branch_name
git stash pop

他の選択肢

  • 変更をそのまま残したいなら先にコミットする
  • 不要な変更なら取り消してからリベースする
  • 競合が起きやすいファイルは退避前に内容を確認する