I use git notes in my repository. Sometimes I need to find a commit with note that includes given string. So far I was using this command:
git log --show-notes=* --grep="PATTERN" --format=format:%H
The problem here is that this prints every commit SHA with PATTERN, even if it's not in notes only in commit message. Is there a better way for that?
There is a placeholder for notes in the format string,
%N. I don't know how to print the notes in one line, so I use a loop to test notes of all reachable commits one by one.Try
You can change
echo $committogit log -1 --show-notes $commit.