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

DEV Challenges are live now!

DEV Challenges Hub

Check out all the ways to participate, certify your skills, and win prizes.

Visit the Challenges Hub

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay