Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

29
  • 16
    I guess trivial; How about include only source code files (eg *.cpp). We have some bin files committed :) Commented Sep 5, 2012 at 14:25
  • 63
    Stick grep cpp | in there before the xargs, then. Commented Sep 5, 2012 at 15:18
  • 49
    Use git ls-files -z | xargs -0 wc -l if you have files with spaces in the name. Commented Nov 19, 2013 at 4:33
  • 57
    For including/excluding certain files use: git ls-files | grep -P ".*(hpp|cpp)" | xargs wc -l where the grep part is any perl regex you want! Commented Nov 19, 2014 at 14:41
  • 44
    If you were interested in just .java files you can use git ls-files | grep "\.java$" | xargs wc -l Commented Dec 9, 2014 at 15:27