سؤال

I have the following:

$ tree
.
├── bar
│   ├── foo.js
│   ├── foo.herp
│   ├── foo.derp
│   └── foo.py
├── bar.herp
└── baz.py

I want to use the following

git ls-files -- {} where {} is some sort of glob pattern

and I want it to return

bar/foo.js
bar/foo.py
baz.py
هل كانت مفيدة؟

المحلول

You can provide any number of glob expressions after ls-files:

git ls-files -- '*.js' '*.py'

نصائح أخرى

Nope. As of git version 2.20.1

git ls-files -- '**/*.js' '**/*.py'

Will return no files

git ls-files -- '**/*.js'

Will return all .js files in the repo

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top