Is there any way to get the output of running git diff --numstat
and git diff --name-status
combined in one run?
My problem is that if I am using only --numstat
then I don't know whether there were just added some new lines to a file or if the file is completely new. When using --name-status
I get the information if the file is new or not but the stats about the line modifications are missing.
Currently my workaround is running both commands separately and then merging that output by a PowerShell script but as the repo is rather big I would like to have the needed output in the first place. Thanks in advance for any help!
you can combine the --numstat
and the --summary
flags;
git diff --numstat --summary
Note that a new file cannot be in the "unstaged" area; so suppose you used "git add" and "git rm", then your git status will look like this:
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: b
# deleted: a
then using
git diff --cached --numstat --summary
will give you:
540 0 b
0 3 a
create mode 100644 b
delete mode 100644 a
NOTE : you can use the --numstat
and the --summary
flags in combination with git diff
, git diff --cached
, git show
and probably other commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With