How do we exclude Notes added by 'git notes add'
from git log
?
When we run git log --all
, there are millions of lines with Notes added by 'git notes add'
. We need --all to see everything else. We just don't want the commits that add the notes. However, we do want to see the actual notes itself that was attached to commits.
There's probably a duplicate question somewhere out there but I've search for over 8 hours and still can't find one.
For example: git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset) %C(red)%N %C(reset)' --all
displays the following (where Tested
is the notes):
Tested
We actually want:
Tested
We don't want:
Using --no-notes actually produces the following, which is NOT the output we want:
Git version is 1.7.1
The current work around we have is to use | grep -v 'Notes added by' | less -r
but the output now gets colored strangely with the graph lines are displayed in rainbow colors for some reason.
git log --exclude='refs/notes/*' --all ...
From the docs:
--exclude=<glob-pattern>
Do not include refs matching <glob-pattern>
that the next --all, --branches, --tags,
--remotes, or --glob would otherwise consider.
Repetitions of this option accumulate
exclusion patterns up to the next --all,
--branches, --tags, --remotes, or --glob
option (other options or arguments do not
clear accumulated patterns).
The patterns given should not begin with
refs/heads, refs/tags, or refs/remotes when
applied to --branches, --tags, or --remotes,
respectively, and they must begin with refs/
when applied to --glob or --all. If a trailing
/* is intended, it must be given explicitly.