0
0

More than 5 years have passed since last update.

git check outで、ブランチの変更ができないとき

Last updated at Posted at 2019-03-09

現在のブランチAから、移動したいブランチBへgit check outをしたところ、このようなエラーがでた。

error: Your local changes to the following files would be overwritten by checkout:
        ファイル名
Please commit your changes or stash them before you switch branches.
Aborting

解決法

「現在のブランチではコミットはしたくない」というときに。
stashで、コミットしていない変更を一時退避させ、ブランチの切り替えを行うことができる。

git stash

メッセージをつけて一時退避させたい時は。

git stash save “message”

stashそのほかのコマンド。

git stash list   #一時退避の一覧表示
git stash pop   #一時退避を戻す(stash popで、stashは破棄される)
git stash clear #一時退避しているものを全削除する
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0