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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.