Add Summarize Amount Of Change For Specific Commit as a Git TIL

This commit is contained in:
jbranchaud
2026-09-23 16:22:56 -05:00
parent 30e37f28aa
commit 56ee385e96
2 changed files with 33 additions and 1 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
_1881 TILs and counting..._ _1882 TILs and counting..._
See some of the other learning resources I work on: See some of the other learning resources I work on:
@@ -457,6 +457,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Stash Everything](git/stash-everything.md) - [Stash Everything](git/stash-everything.md)
- [Stashing Only Unstaged Changes](git/stashing-only-unstaged-changes.md) - [Stashing Only Unstaged Changes](git/stashing-only-unstaged-changes.md)
- [Stashing Untracked Files](git/stashing-untracked-files.md) - [Stashing Untracked Files](git/stashing-untracked-files.md)
- [Summarize Amount Of Change For Specific Commit](git/summarize-amount-of-change-for-specific-commit.md)
- [Switch To A Recent Branch With FZF](git/switch-to-a-recent-branch-with-fzf.md) - [Switch To A Recent Branch With FZF](git/switch-to-a-recent-branch-with-fzf.md)
- [Transition A Branch From One Base To Another](git/transition-a-branch-from-one-base-to-another.md) - [Transition A Branch From One Base To Another](git/transition-a-branch-from-one-base-to-another.md)
- [Turn Off The Output Pager For One Command](git/turn-off-the-output-pager-for-one-command.md) - [Turn Off The Output Pager For One Command](git/turn-off-the-output-pager-for-one-command.md)
@@ -0,0 +1,31 @@
# Summarize Amount Of Change For Specific Commit
To get a quick headline summary of the amount of change that happened in a
commit, I can use the `--shortstat` flag. This will sum up file changed, lines
added, and lines removed. This can be combined with an _empty_ format flag to
suppress all other output.
I can run this for the latest commit on the current branch by referencing
`HEAD`.
```bash
❯ git show --shortstat --format= HEAD
3 files changed, 1046 insertions(+), 462 deletions(-)
```
Or I can point at some other commit via its SHA:
```bash
❯ git show --shortstat --format= 8cbfcdd7
1 file changed, 238 insertions(+)
```
I can even summarize the amount of change for the entire feature branch I'm
working on by referencing a range between `main` and the `HEAD` commit.
```bash
❯ git diff --shortstat main...HEAD
36 files changed, 1125 insertions(+), 134 deletions(-)
```
See `man git-show` and `man git-diff` for more details.