Gitはリストからすべてのファイルを保存解除します。

Gitはリストからすべてのファイルを保存解除します。

私は以下を使用してリストを作成しました。

$ git stash show --name-only | grep -i "Kopie"

出力:

A - Kopie.txt
B - Kopie.txt

リストからすべてのファイルを非表示にする方法は?


最初の方法:

$ git stash show --name-only | grep -i "Kopie" | xargs git checkout stash@{0} --

結果:

error: pathspec 'A' did not match any file(s) known to git.
error: pathspec '-' did not match any file(s) known to git.
error: pathspec 'Kopie.txt' did not match any file(s) known to git.
error: pathspec 'B' did not match any file(s) known to git.
error: pathspec '-' did not match any file(s) known to git.
error: pathspec 'Kopie.txt' did not match any file(s) known to git.

ベストアンサー1

に渡すときにファイル名を参照しないため、git checkout&は別のファイルとして扱われAます。-Kopie.txt

-I {}オプションを追加してxargs引用符で囲んでください{}

git stash show --name-only | grep -i "Kopie" | xargs -I {} git checkout stash@{0} -- "{}"

おすすめ記事