Search code examples
gitbashgit-diff-tree

Exclude files from git diff-tree


I execute command:

git diff-tree --diff-filter=ACMR --no-commit-id --name-only -r $COMMIT^1.. --

from the result I create zip archive.

How can I exclude specific files from the result generated by the above command ?


Solution

  • I'm not sure you can get diff-tree to do that for you unless you can specify paths that you are interested in explicitly after the --.

    But you can post-process that list with grep/sed/awk/etc. at the very least.

    Actually, you might be able to use zip's -x argument to do the exclusions for you directly in the zipping step as well.