0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git】gitコマンドで特定のスタッシュを削除する

Last updated at Posted at 2025-02-07

状況

普段はSourceTree使いなのですが、でかい差分のスタッシュを削除しようとしたメモリが足らずにSourceTreeがフリーズしてしまいました。
そんなわけで仕方なくコマンドでスタッシュを削除することにしました。

やり方

まずはリスト確認

git stash list

を実行すると

stash@{0}: On ブランチ名: スタッシュ名
stash@{1}: ...
stash@{2}: ...
...

このように一覧を確認できます。

いよいよ削除(ご安全に)

続いて

git stash drop 'stash@{1}'

を実行すると番号1が振られたスタッシュが削除されます。

補足

ネットで調べるとgit stash drop stash@{1}が出てくるんですけど、これだとerror: unknown switch 'e'が出てダメでした。シングルクオーテーションで囲むと通ります。

0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?