git count files in the staged index

前端 未结 8 502
难免孤独
难免孤独 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:35

    Try git status -s:

    git status -s | egrep "^M" | wc -l
    

    M directly after start-of-line (^) indicates a staged file. ^ M, with a space, would be an unstaged but changed file.

提交回复
热议问题