I'm trying to summarize my work on a project. The problem is that I do not want to include test files in the output of git log --patch
.
The files are in a single directory called mtest
; however, that folder also contains test suite code that I do want to show. Test files, which I want to exclude, have extension mscx
or xml
, so I would want the filter to work based on that.
I have looked at Making 'git log' ignore changes for certain paths but this looks like it excludes commits that modified a file instead of simply excluding the file.
Is there a way to do this?
I have tried Jubobs answer, and it seemed worked, but surprisingly 2 files came up even with the filter on.
I have reproduced this with this small repository:
mkdir test
cd test
git init
echo 'readme' > README
git add .
git commit -m "Initial commit"
mkdir test2
cd test2
echo 't1' > test1.cpp
echo 't2' > test2.xml
git add .
git commit -m "c2"
echo 't3' > test3.cpp
echo 't4' > test4.xml
git add .
git commit -m "c3"
I noticed that files are not filtered when a directory is created. I have tried the following commands:
git log --patch -- . ":(exclude)**/*.xml"
which resulted in both xml files to be included.
git log --patch -- . ":(exclude)*.xml"
This surprisingly filters out the test4.xml
but not test2.xml
.