Assume I have
git status
...
Changes not staged for commit:
modified: A.R
modified: B.Rmd
modified: C.txt
...
Is there a way to do the following:
git add *.Rmd OR *.R
or
git stash *.Rmd OR *.R
git add "*.R"
works fine (with quotes). In the doc, it's mentioned as the <pathspec>
you can give as a parameter.
For stash, you'll have to explicitly use the (usually implied) push
:
git stash push "*.R"
The doc mentions :
When pathspec is given to git stash push, the new stash entry records the modified states only for the files that match the pathspec.
(Edit after comments) And if you need both types, just give multiple pathspecs like this :
git add "*.R" "*.Rmd"
git stash push "*.R" "*.Rmd"