Can I write a more compact rule for git add?

I need to add to the phased area all ini files of the current directory and its subdirectories recursively. Is there one filter for him?

I use it:

 git add *.ini ./**/\*.ini 

So, I have indicated two selection rules. Can I write it more compactly with a single rule?

I tried the following options: **/\*.ini , ./**/\*.ini , */**/\*.ini , but they do not match.

+6
source share
2 answers

Use git add "*.ini" . Putting *.ini in quotation marks prevents your shell from expanding the template to just the appropriate file (s) in your current directory before even passing the git argument.

+10
source

In general, you can use find for more complex operations:

 find . -type f -name '*.ini' -exec git add {} + 
+1
source

All Articles