假设我有
git status
...
Changes not staged for commit:
modified: A.R
modified: B.Rmd
modified: C.txt
...
有没有办法做到以下几点:
git add *.Rmd OR *.R
要么
git stash *.Rmd OR *.R
git add "*.R"
工作正常(带引号)。在文档中,它被称为<pathspec>
,你可以作为参数。
对于藏匿,你必须明确使用(通常暗示的)push
:
git stash push "*.R"
该文件提到:
当pathspec被赋予git stash push时,新的存储条目仅记录与pathspec匹配的文件的修改状态。
(在评论后编辑)如果你需要两种类型,只需给出如下的多个路径规范:
git add "*.R" "*.Rmd"
git stash push "*.R" "*.Rmd"