LoginSignup
2
2

More than 5 years have passed since last update.

PowerShellでGitのstash番号を指定するコマンドを実行するとエラーになる

Posted at

PowerShellで git show stash@{0} のようなstash番号を指定するコマンドを実行するとエラーになる。

PS C:\repo> git show stash@{0}
fatal: ambiguous argument 'stash@': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

波括弧( {})は、PowerShellではブロックや変数表記に使われるため、コマンド引数として指定したつもりでも、PowerShell構文として解釈されてしまう。

このような場合、stash番号をダブルクォーテーションかシングルクォーテーションで囲めばよい。

git show "stash@{0}"
2
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
2
2