brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: git log --stat shows which files each commit touched

Git
~/tips/tip-git-log-stat

git log --stat -5

List commits together with a per-file summary of what changed

The plain git log tells you what a commit says, not what it touched. Opening each commit to see the files is a slow way to find out.

Add --stat:

git log --stat -5

Under every commit you get the list of changed files, with a count of added and removed lines and a small bar of plus and minus signs. The last line adds up the totals for that commit. It is a quick way to see that a commit touched three files or three hundred.

It combines well with a path. git log --stat -- docs/ only lists commits that touched the docs folder, and only shows those files. For a tighter view, --oneline --stat puts the message on one line and keeps the file list below it.

If you only want the file names without the bars, use --name-only, or --name-status to see whether each file was added, modified or deleted.

A caveat: long paths get shortened with ... to fit the terminal width. Use --stat=200 to give the output more room.

Further reading: git-log documentation

More Git tips git show-branch main feature git merge --no-ff feature -m "Merge feature" git merge --squash feature git merge --abort git branch --edit-description [<branch-name>] All Git tips (144) All topics

Link