jimmy
jimmy

Reputation: 21

git log regex search

I just found out the differences between git log --all -G "mystring" and, git log --all -S "mystring" as you can see here, for example.

But, I'd like to know if I can specify several regular expressions (a.k.a. regex) to -G, with something like: git log --all -G "str1" --and -G "str2"

Of course, I can always wrap git commands inside python or bash scripts, but I'd like to know if using pure-git-commands, I can do this.

Thanks very much!!

Upvotes: 0

Views: 2367

Answers (1)

Tony Vincent
Tony Vincent

Reputation: 14372

To search the commit log (across all branches) for the given text:

git log --all --grep='String'

so

git log --grep=str1 --grep=str2

will list commits mentioned either str1 or str2 in their commit log messages

Upvotes: 1

Related Questions