问题
I have a large project that I use sparse checkout to exclude one directory (which is quite large). However, when I use git log, the commit in the directory that I already excluded with sparse checkout will show up, polluting my real interests.
The answer given for this question by specifying one directory doesn't work for me since I need to exclude one directory but include many. I came from perforce where if I specify ...
, it will not include files or directories that were excluded by my p4 client spec.
回答1:
Use the exclude
option with pathspecs. For instance:
$ git log --first-parent --name-status -- ':(exclude)plugin/'
in a clone of the syntastic repository doesn't show commit 69b0c3e85a319ad21f560d7b25524cf02921be82, while git log
without the exclusion does show it.
来源:https://stackoverflow.com/questions/56139490/git-log-filter-with-sparse-checkout