My main aim is to filter out all pull request merges thus in theory i would expect the following to work(it doesn't)
git log --grep="^!(Merge)"
Do I miss something ?
First, you can't simply negate a word in a regexp by putting a bang in front of it (where did you find that?). You might have used lookarounds for that, but regular grep regexps do not support them. Using grep directly you can pass -P
option to use much more powerful Perl regexps, but I didn't find similar option for git log.
Though, there is --no-merges
option that will filter out all merge commits from the log:
git log --no-merges
Man page says that --no-merges
means:
Do not print commits with more than one parent
That is not correct you ant use regex like that something like this would be better:
git log | grep -o '^(Merge)'
And this would provide more info:
git log --pretty=format:'%h by %an, %ar, %s' | grep -o '^((?!Merge).)*$'
I think you used ! To inverse it but the only known way of inverse revex search i know of is like above. Still the --no-merge would provide better info just writing for future referance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With