0

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!!

1
  • 1
    Not quite an answer, but: -S takes a string while -G takes a regex (already), and you can make the -S argument a regex by adding --pickaxe-regex. See the gitdiffcore documentation: kernel.org/pub/software/scm/git/docs/gitdiffcore.html - and then note that "exp1 AND exp2" is almost (but not exactly) "(exp1.*exp2)|(exp2.*exp1)" in "regex algebra". Commented Sep 6, 2016 at 3:47

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Should also show the --all-match option, which ANDs all of the --greps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.