Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering (excluding) git log results by filename extension

Tags:

git

I’m looking for a particular string in a git repository, but I’d like my git log -Swhatever -p results to exclude any changes made to anything CSS related, e.g. any file with a file extension of .css or .scss

Is there a filter option or something in git log that I’m missing?

So far I’ve got git log -Swhatever -p -- '*.erb' '*.rb' '*.coffee' '*.js' as likely suspects for “other kinds of file extensions where my string might be” but I bet I’m going to miss some file extensions.

like image 834
Edward Ocampo-Gooding Avatar asked Sep 29 '22 00:09

Edward Ocampo-Gooding


1 Answers

@torek is right!

The way to do this is as simple as:

git log -Swhatever -p -- . ':(exclude)*.css' ':(exclude)*.scss'

like image 68
Edward Ocampo-Gooding Avatar answered Oct 02 '22 14:10

Edward Ocampo-Gooding