• L
    git log: add '--merges' flag to match '--no-merges' · b8e8db28
    Linus Torvalds 提交于
    I do various statistics on git, and one of the things I look at is merges,
    because they are often interesting events to count ("how many merges vs
    how much 'real development'" kind of statistics). And you can do it with
    some fairly straightforward scripting, ie
    
    	git rev-list --parents HEAD |
    		grep ' .* ' |
    		git diff-tree --always -s --pretty=oneline --stdin |
    		less -S
    
    will do it.
    
    But I finally got irritated with the fact that we can skip merges with
    '--no-merges', but we can't do the trivial reverse operation.
    
    So this just adds a '--merges' flag that _only_ shows merges. Now you can
    do the above with just a
    
    	git log --merges --pretty=oneline
    
    which is a lot simpler. It also means that we automatically get a lot of
    statistics for free, eg
    
    	git shortlog -ns --merges
    
    does exactly what you'd want it to do.
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    b8e8db28
revision.h 4.0 KB