git status with number of lines changed

1k Views Asked by At

i want git status to also list number of lines changed, like those + and - on git pull:

example)

❯ LANG=c git status
On branch develop
Your branch is up to date with 'upstream/develop'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   package-lock.json | 1093 ++++++++---
        modified:   package.json      | 26   +++---

since i could not find such options in docs, i then tried using diffstat, since it was used for git pull.

❯ git diff | diffstat -C
 package-lock.json | 1093 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
 package.json      |   26 +-
 2 files changed, 915 insertions(+), 204 deletions(-)

however there's two problems:

  1. diffstat results are entire terminal wide, so merging the result with git status result would break lines
  2. git diff cannot diff against untracked files

using lots of bash could fix 1, but i'm not sure how i could do 2 without modifying the index.

0

There are 0 best solutions below