2
git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHORT_SHA

gives me the list all the files that were committed for that SHA.

I am looking for a way to get a list of files with only .xml or .html extensions.

I checked the documentation page - here and couldn't see any option.

Any help is greatly appreciated.

Ashwin
  • 12,081
  • 22
  • 83
  • 117

1 Answers1

2

You can use -- <path> [<otherpath> ...] for this :

git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHORT_SHA -- *.xml *.html

Be sure to put it at the end of the command, with no options behind it, since git will treat anything past it as paths.

Doc from the git log page here, but this is usable for a lot of display commands.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
  • 1
    depending on your shell : you may want to put quotes around `"*.xml"` and `"*.html"`, so that they don't get expanded before executing the git command. – LeGEC Apr 06 '21 at 09:41