LoginSignup
2
1

More than 1 year has passed since last update.

git 一次避難

Last updated at Posted at 2022-07-04

作業が途中でコミットしたくないけど別のブランチで作業しないといけない。
そういう時に作業を一時避難する。

作業を一次避難する

git stash
git stash save

作業した作業リストを確認する

git stash list

保存した変更を戻す

git stash pop # 最新のスタッシュを適用する
git stash pop stash@{1} # 複数ある場合はスタッシュ番号を指定する

避難した作業を復元する

git stash apply

ステージの状況も復元する

git stash apply --index

特定の作業を復元する

git stash apply [スタッシュ名]
git stash apply stash@{1}

*applyは適用するという意味

避難した作業を削除しよう

git stash drop

特定の作業を削除する

git stash drop [スタッシュ名]
git stash drop srash@{1} # 複数ある場合はスタッシュ番号を指定する

全作業を削除する

git stash clear
2
1
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
2
1