Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git won't add certain globs

I'm left scratching my head on this one. So, in git on OSX, you can add files like:

git add *.java

and it will add all files that have the *.java extension. Same for .txt, json, etc. However, when I do a

git add *.xml

nothing happens. It's not specified in my gitignore, so git is reporting it as changed with a git status, but I can't seem to add with the globbing pattern.

I'm not asking HOW to recursively add files by pattern, git, (or bash?) already does that, as explained in my first example.

System:

  • OSX 10.10.5
  • GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
  • git version 2.3.8 (Apple Git-58)
like image 929
BrDaHa Avatar asked Dec 03 '25 02:12

BrDaHa


1 Answers

Quote the glob so that it passed to git for processing, rather than expanded by the shell.

git add '*.xml'
like image 130
chepner Avatar answered Dec 05 '25 15:12

chepner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!