git count files in the staged index

前端 未结 8 504
难免孤独
难免孤独 2021-02-01 12:05

I\'m trying to figure out how to easily count the files in my uncommitted index.

I\'ve tried:

git status | grep \'#\' | wc -l

but there

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-01 12:59

    Maybe it was not available 9 years ago, but as of 2019, ls-files is much faster than diff --stat:

    git ls-files --cached | wc -l
    

提交回复
热议问题