Open1

新規作成したファイルも含めてgit diffで差分の行数を出力したい

neco3coffeeneco3coffee

https://tracpath.com/docs/git-diff/

$ git diff --shortstat
9 files changed, 157 insertions(+), 10 deletions(-)

上記のコマンドだと、
working directoryのModified(修正された)状態のファイル9つの差分しか出力されない
Untracked(追跡されてない)状態のファイル3つ分が出力されていない、

https://khid.net/2020/05/git-working-directory-staging-area-repo-command/

なので、一旦 git add .して全てのファイルをstaging areaに持ってきて

$ git diff --staged --shortstat
12 files changed, 813 insertions(+), 10 deletions(-)

すると、新規作成したファイルも含めて差分を出力してくれるっぽい

https://tracpath.com/docs/git-diff/

--stagedは--cachedと同義語となります。

--staged と--cachedって同じなのか、、

それにしても差分が多すぎるンゴ、