Josh Brunton
Josh Brunton

Reputation: 435

Using "x AND y" instead of "x OR y" when using --grep twice in git-log

I'm trying to find commits whose commit message includes both key words "x" and "y". I've tried using git log --grep="x" --grep="y", and while this does include all commits with X and Y, it also includes those with just X or just Y.

Is there a way to grep by two expressions and inlcude only those which match both?

Upvotes: 1

Views: 46

Answers (1)

Lajos Arpad
Lajos Arpad

Reputation: 76462

You need the --all-match flag:

git log --grep="x" --grep="y" --all-match

Upvotes: 2

Related Questions