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.
當它們被傳遞給時,您沒有引用文件名
git checkout
, 所以A
,-
&Kopie.txt
被視為不同的文件。嘗試將
-I {}
選項添加到xargs
,然後在周圍加上引號{}
:git stash show --name-only | grep -i "Kopie" | xargs -I {} git checkout stash@{0} -- "{}"