DEV Community

Pavol Z. Kutaj
Pavol Z. Kutaj

Posted on

How to Use Delta Pager without Headings

The aim of this page📝 is to explain how to configure Delta to omit hunk headers in git diff outputs, resulting in cleaner and more readable diffs. I have looked for it for quite some time — the feature is called Hunk Header. I have a data file of 80MB (Consul KV Dump with each KV per line) and need to compare past VS current (HEAD) version.
• Delta is a syntax-highlighting pager for git, diff, and grep outputs. 
• By default, git diff includes hunk headers, which can clutter the output.
• To remove these headers, configure Delta’s hunk-header-style to omit.
• This setting is specified in the Git configuration file.
• The configuration line to add is:

[delta]
    hunk-header-style = omit
Enter fullscreen mode Exit fullscreen mode

• This configuration instructs Delta to omit the hunk header section from the output. 
• After updating the configuration, run git diff as usual:

git diff -U0 <commit_hash> HEAD --color | delta
Enter fullscreen mode Exit fullscreen mode

• The -U0 option ensures only the modified lines are shown.
• The --color option enables syntax highlighting.
• The | delta pipes the output through Delta for enhanced formatting.
• This setup results in a cleaner diff display, focusing solely on the changes without additional semantic headers.

LINKS

https://github.com/dandavison/delta/issues/364
https://github.com/dandavison/delta
https://dandavison.github.io/delta/full—help-output.html

Top comments (0)