Reputation: 479
While working with R, Rstudio creates all these files:
.Rhistory
.Rapp.history
.Rproj.user/
I want git to ignore these files so I put them in .gitignore, and to do it in one line I use
*.R*
but it will also ignore actual .R files which I don't want. So I tried the below regexes,
*.R.+
and
*.R+
but I guess there is some other equivalent for dot (. for single character match) or plus (+ for one or more occurrences of previous letter) in gitignore which I am unaware of. Can anyone help?
Upvotes: 6
Views: 2646
Reputation: 174786
Here you need to use ?
. ?
in glob matches any single character.
*.R?*
*
Matches any string, including the null string. When the globstar shell option is enabled, and ‘’ is used in a filename expansion context, two adjacent ‘’s used as a single pattern will match all files and zero or more directories and subdirectories. If followed by a ‘/’, two adjacent ‘*’s will match only directories and subdirectories.
?
Matches any single character.
Upvotes: 10