算上一个Git仓库的行数 [英] Count number of lines in a git repository

查看:112
本文介绍了算上一个Git仓库的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应如何计算在一个Git仓库的所有文件行present总数?

git的LS-文件给我用的git跟踪的文件列表。

我正在寻找一个命令所有这些文件。类似

  git的LS-文件| [猫所有这些文件] |厕所-l


解决方案

的xargs 会做你想要什么:

  git的LS-文件| xargs的猫|厕所-l

但随着更多的信息,可能会更好,你可以这样做:

  git的LS-文件| xargs的厕所-l

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.

I'm looking for a command to cat all those files. Something like

git ls-files | [cat all these files] | wc -l

解决方案

xargs will do what you want:

git ls-files | xargs cat | wc -l

But with more information and probably better, you can do:

git ls-files | xargs wc -l

这篇关于算上一个Git仓库的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆