Skip to content

Lines of code per git author #942

@RocketJannis

Description

@RocketJannis

It would be cool, if there was an option to show lines of code per Git author using git blame.

I found this command somewhere some time ago that does exactly that (note that it filters for java and kt files here):

git ls-tree --name-only -z -r HEAD|egrep -z -Z -E '\.(java|kt)$' |xargs -0 -n1 git blame --line-porcelain|grep "^author "|sort|uniq -c|sort -nr

The output looks like this:

  22916 author jannis
   2076 author other name
   1576 author another name
   1552 author 3rd name

The problem is that this also counts blank lines and comments which cloc already solves.
Feel free to just close if this is out of scope for cloc. Thank you for reading and the best line counter I know :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions