From 45d7473b8ae6aeff465697494b2e51a4d5cdd8cd Mon Sep 17 00:00:00 2001 From: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:45:15 +0200 Subject: [PATCH] Update diff-index.md --- .../git/commands/diff-index.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cheatsheets/version-control/git/commands/diff-index.md b/cheatsheets/version-control/git/commands/diff-index.md index 02dfde34d..29f269279 100644 --- a/cheatsheets/version-control/git/commands/diff-index.md +++ b/cheatsheets/version-control/git/commands/diff-index.md @@ -116,23 +116,27 @@ $ git diff-index --cached HEAD Jump to [Diff filter](#diff-filter) section. -Summary view, close to `git status -s`. +Summary view: -```sh +```console +$ git diff-index --name-status HEAD +M src/extension.ts +A src/workspace.ts $ git diff-index --cached --name-status HEAD A src/workspace.ts ``` +That can be achieved with these: + ```sh -$ git diff-index --name-status HEAD -M src/extension.ts -A src/workspace.ts +$ git status --short +$ git diff --name-status ``` ### Stat ```sh -$ git diff-index --stat --cached HEAD +$ git diff-index --stat --cached HEAD src/workspace.ts | 8 ++++++++ 1 file changed, 8 insertions(+) ``` @@ -140,12 +144,12 @@ $ git diff-index --stat --cached HEAD ### Num stat ```sh -$ git diff-index --numstat --cached HEAD +$ git diff-index --numstat --cached HEAD 8 0 src/workspace.ts ``` ```sh -$ git diff-index --numstat HEAD +$ git diff-index --numstat HEAD 82 55 src/extension.ts 8 0 src/workspace.ts ```