Git stash

$ git stash:一時的に避難して、他のブランチで作業をしたい時に使う。

$ git commit前に、$ git stashを打つ

$ git stash list:git stash した作業 一覧を表示するコマンド
$ git stash apply:最新の作業 を復元する

特定の作業を復元:$ git stash apply [stash名]

$ git stash drop:最新の作業 を削除する

特定の作業を削除:$ git stash drop [stash名]

全ての作業を復元:$ git stash clear

% git st
On branch main
Changes not staged for commit:

        modified:   home.html

no changes added to commit (use "git add" and/or "git commit -a")

% git stash  ※ <- ここ!!!
Saved working directory and index state WIP on main: ecd53dd third.htmlを追加

% git stash list  ※ <- ここ!!!
stash@{0}: WIP on main: ecd53dd third.htmlを追加

% git stash apply  ※ <- ここ!!!
On branch main
Changes not staged for commit:

        modified:   home.html

no changes added to commit (use "git add" and/or "git commit -a")

% git stash list
stash@{0}: WIP on main: ecd53dd third.htmlを追加
% git stash drop  ※ <- ここ!!!
Dropped refs/stash@{0} (b68a24367c928c407bda2e40d9d127316740bdb9)
% git stash list
% 

% git checkout home.html  ※ <- ここ!!!:home.html という変更を無かったことにする
Updated 1 path from the index
% git st                
On branch main
nothing to commit, working tree clean