1

I am trying to count the commits by each author but like to exclude commits whos messages begin with the word TEST.. for example.

I am currently doing the following to get the list.

 git shortlog -s -n --all

This brings back my counts but drilling into each authors commits shows a lot which start with TEST.. I would like to get the count without these commits included.. is this possible?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1002794
  • 123
  • 1
  • 11
  • what you talking about is inversion of `git log --grep=` searching for a commit which does not contains a particular pattern . i found this thread you might find useful http://stackoverflow.com/questions/5602204/how-to-invert-git-log-grep-pattern-or-how-to-show-git-logs-that-dont-matc – Malik Jun 10 '15 at 09:20

1 Answers1

0

The following one-liner will work. I am using Git Bash, which is up to version 1.9.4.

git shortlog $(git log --pretty=format:"%H %s" | grep -v 'stuff' | cut -c -40) --no-walk

If you have a later version that accepts the --invert-grep option you can probably use the following. (I noticed that shortlog seems to take all the same arguments as log, but it is undocumented.) I cannot test this though.

git shortlog --grep 'stuff' --invert-grep
Joseph K. Strauss
  • 4,683
  • 1
  • 23
  • 40