git grep has a -h option to omit the filename, but that option has no effect when given with -c: ~/src/linux$ git grep -h 'example' | head -n 2 For example, if you distribute copies of such a program, whether may not distribute the Program at all. For example, if a patent ~/src/linux$ git grep -hc 'example' | head -n 2 COPYING:2 Documentation/.gitignore:1 By contrast, standard grep does respect -h with -c: ~/src/linux$ grep -rh example * | head -n 2 For example, if you distribute copies of such a program, whether may not distribute the Program at all. For example, if a patent ~/src/linux$ grep -rhc example * | head -n 2 0 2 (Also interesting that git grep omits files with a count of 0, while grep does not.) - Josh Triplett