0
0

More than 3 years have passed since last update.

git stash関連のコマンド(備忘録)

Posted at

ブランチを切り替えるのを忘れてしまったり、git pullするのを忘れてしまったりと、
気をつけていてもやらかしてしまうことありますよね。

そんなときの強い味方、git stashのコマンドの備忘録です。

コードを退避する

git stash 

Saved working directory and index state WIP on master: ....

一覧を見る

git stash list

stash@{0}: WIP on master: 8af0e2a Merge branch ....
stash@{1}: WIP on master: c8743b8 Merge branch ....
stash@{2}: WIP on master: 49a6d3c Merge branch ....

stashを適用する(stashを適用後、残す場合)

git stash apply stash@{n}

stashを適用する(stashを適用後、削除する場合)

git stash pop stash@{n} 

stashを削除する

git stash drop stash@{n}

Dropped refs/stash@{0} (2aaab50a6a629d3f9cac314f4491dac85231583f)




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