admin管理员组文章数量:1334326
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?
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?
Share Improve this question edited Nov 20, 2024 at 10:28 phd 95.2k14 gold badges158 silver badges207 bronze badges asked Nov 20, 2024 at 9:39 Josh BruntonJosh Brunton 5461 silver badge20 bronze badges 1 |1 Answer
Reset to default 2You need the --all-match
flag:
git log --grep="x" --grep="y" --all-match
本文标签: git logUsing quotx AND yquot instead of quotx OR yquot when using grep twice in gitlogStack Overflow
版权声明:本文标题:git log - Using "x AND y" instead of "x OR y" when using --grep twice in git-log - Stack Ove 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742368250a2461724.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
git log --help
. What you want seems to be the option listed right below--grep
, which is--all-match
. Alternatively you can use regex in the pattern. E.g.: Looking for commits with "analysis notebook" in them I can use "analysis * notebook" and get what I want, or the two words as separate grep patterns, joined with--all-match
– Nox Commented Nov 20, 2024 at 9:45