3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fishでgit stashできないの?と感じたので調べてみた

Posted at

概要

自分はshellfishを使っています。

ある対応をしていて、git stashを使いたい場面に遭遇して使ってみると

git stash list

stash@{0}: On `ブランチ名`: `stash message`

git stash pop stash@{0}

error: stash@0 is not a valid reference

なぜ!?

ブレース展開

答えはブレース展開にありました。

fishでは{}の動きが他のshellとは違っています。

  • bash
echo {1..10}

1 2 3 4 5 6 7 8 9 10

このような使い方をしますが、

  • fish
echo input.{c,h,txt}

input.c input.h input.txt

fishではこのような動きになり、{}展開という動きになります。

git stashしたい

ではどうすればいいのかというと、エスケープしてあげます。

git stash pop stash@\{0\}

バックスラッシュで{}をエスケープし、展開させないようにします。

最後に

このような対応で無事できましたが、タブ補完でもエスケープしてくれました。。。

fish賢いですね〜

3
0
3

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?