Count number of lines in a git repository

后端 未结 16 2623
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 03:17

How would I count the total number of lines present in all the files in a git repository?

git ls-files gives me a list of files tracked by git.

16条回答
  •  温柔的废话
    2020-12-02 03:39

    If you want to get the number of lines from a certain author, try the following code:

    git ls-files "*.java" | xargs -I{} git blame {} | grep ${your_name} | wc -l
    

提交回复
热议问题