I am trying to identify all commits with a message not starting with [core]
. These are my failed attempts:
Simple approach
git rev-list --grep '^(?!(\[core\]).).+' "branch1...branch2"
- empty result
Enable extended flag
git rev-list -E --grep '^(?!(\[core\]).).+' "branch1...branch2"
Error message
fatal: command line, '^(?!(\[core\]).).+': Invalid preceding regular expression
.It seems that a negative look-ahead is not supported by git grep.
Comparing the list of all commits to the list of those with the tag (cf. this answer):
git rev-list "branch1...branch2" | grep -Fxv <(git rev-list -E --grep '^\[core\].+' "branch1...branch2")
- Results in
sh: syntax error near unexpected token `('
- Results in
P.S: I cannot upgrade to Git 2.x, so --invert-grep
is not an option
Something like this might work.
Select the revisions in that list that match the pattern you don't want and then use
--not
to negate that list of revisions in another call torev-list
.You could also avoid the process substitution in your third attempt by using an actual file like this: