开发者

Get number of files in git repository at any revision

开发者 https://www.devze.com 2023-02-07 13:58 出处:网络
I\'d like to be able to find the number of files in a Git repository at a given revision, preferably without having to check out the revision first.

I'd like to be able to find the number of files in a Git repository at a given revision, preferably without having to check out the revision first.

I thought git ls-files might get me somewhere, but I'm not able to see any way of passing Git a 开发者_开发技巧revision for it.

Thanks in advance!


ls-files operates on the index, which is by nature associated with the current checkout. Use ls-tree, as in git ls-tree -r --name-only <tree-ish>. If you just want to count lines, using --name-only will speed things up by limiting the output.

0

精彩评论

暂无评论...
验证码 换一张
取 消