The "secret" on how to do it is called:
pathspec magic
You Can simply use this format (introduced in git version >1.9):
# Use this syntax, pay attention to all the parameters and the syntax
# Unix:
git log <any required flags> -p -- . ':(exclude)*.generated.*'
# Windows (double quote) [ Thank to @Cyril Gandon for noticing it]:
# (double quote) should work on all OS as well
git log <any required flags> -p -- . ":(exclude)*.generated.*"
What is this weird syntax?
This syntax is called pathspec magic
.
Using this syntax you can "tell" git which file extensions to exclude. In your case it's the *.generated.*
From the doc:
http://git-scm.com/docs/gitglossary.html
:
A pathspec that begins with a colon :
has special meaning.
In the short form, the leading colon :
is followed by zero or more magic signature
letters (which optionally is terminated by another colon :), and the remainder is the pattern to match against the path.
The magic signature
consists of ASCII symbols that are neither alphanumeric, glob, regex special characters nor colon. The optional colon that terminates the magic signature
can be omitted if the pattern begins with a character that does not belong to "magic signature" symbol set and is not a colon.
In the long form, the leading colon :
is followed by a open parenthesis (, a comma-separated list of zero or more magic words
, and a close parentheses ), and the remainder is the pattern to match against the path.
Note
In older versions (the feature was introduced in git v1.9 and the bug was fixed in git 1.9.5) there was a bug which was fixed.
https://github.com/git/git/commit/ed22b4173bd8d6dbce6236480bd30a63dd54834e
Demo:
git log --stat
(check the last commit)
And the same runt with the filer - you can see that there is only one file in the results instead of 2
git log --stat -p -- . ':(exclude)*dal.js*'
grep -vF '.generated.'
do? – Rosauraroscius