<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Git on Emacs@ Dyerdwelling</title><image><url/><title>Git on Emacs@ Dyerdwelling</title><link>https://www.emacs.dyerdwelling.family/tags/git/</link><width>32</width><height>32</height></image><link>https://www.emacs.dyerdwelling.family/tags/git/</link><description>Recent content in Git on Emacs@ Dyerdwelling</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>captainflasmr@gmail.com (James Dyer)</managingEditor><webMaster>captainflasmr@gmail.com (James Dyer)</webMaster><lastBuildDate>Tue, 21 Apr 2026 08:00:00 +0100</lastBuildDate><atom:link href="https://www.emacs.dyerdwelling.family/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>Highlighting git changes in a buffer with diff-hl</title><link>https://www.emacs.dyerdwelling.family/emacs/20260421070329-emacs--getting-diff-hl-just-right/</link><pubDate>Tue, 21 Apr 2026 08:00:00 +0100</pubDate><author>James Dyer</author><guid>https://www.emacs.dyerdwelling.family/emacs/20260421070329-emacs--getting-diff-hl-just-right/</guid><description>&lt;p>Lately I’ve found myself wanting a better, more fine-grained view of what’s going on in a file under &lt;code>git&lt;/code>. For some reason, my default workflow has been to keep jumping in and out of &lt;code>project-vc-dir&lt;/code> to check changes. It gets the job done, but honestly it’s a bit of a hassle.&lt;/p>
&lt;figure>&lt;img src="https://www.emacs.dyerdwelling.family/emacs/20260421070329-emacs--Getting-diff-hl-Just-Right.jpg" width="100%">
&lt;/figure>
&lt;p>What I really wanted was something right there in the buffer. Not a full-on inline diff (that gets messy fast I would guess), but just a small visual hint, something that lets me &amp;ldquo;see&amp;rdquo; what’s changed without breaking my flow.&lt;/p>
&lt;p>Turns out, that’s exactly what &lt;code>diff-hl&lt;/code> does!&lt;/p>
&lt;p>It’s super lightweight and just highlights changes in the fringe. Nothing flashy but just enough to keep you aware of what you’ve modified. Once you start using it, it feels kind of weird not having it.&lt;/p>
&lt;p>One thing I really like is how nicely it plays with the built-in VC tools, move to a buffer position that aligns with a highlighted change, hit &lt;code>C-x v =&lt;/code> and it jumps straight to the relevant hunk in the diff. No friction, no extra thinking, it just works.&lt;/p>
&lt;p>Here’s the setup I’m using:&lt;/p>
&lt;pre>&lt;code>(use-package diff-hl
:ensure t
:hook (dired-mode . diff-hl-dired-mode)
:config
(global-diff-hl-mode 1)
(diff-hl-flydiff-mode 1)
(unless (display-graphic-p)
(diff-hl-margin-mode 1)))
&lt;/code>&lt;/pre>&lt;p>By default, &lt;code>diff-hl-mode&lt;/code> only updates when you save the file. That’s okay, but enabling &lt;code>diff-hl-flydiff-mode&lt;/code> makes it update as you type, which feels more intuitive.&lt;/p>
&lt;p>Oh, and that &lt;code>dired-mode&lt;/code> hook? That turns on &lt;code>diff-hl-dired-mode&lt;/code>, which gives you a quick visual overview of changed files right inside &lt;code>dired&lt;/code>. It’s one of those small touches that ends up being surprisingly useful.&lt;/p>
&lt;p>If you’ve got &lt;code>repeat-mode&lt;/code> enabled, you can also hop through changes with &lt;code>C-x v ]&lt;/code> and &lt;code>C-x v [&lt;/code>, which makes reviewing edits really smooth.&lt;/p>
&lt;p>I am enjoying &lt;code>diff-hl&lt;/code> and is quietly improving my workflow without getting in my way. Simple, fast, and just really nice to have.&lt;/p></description></item></channel></rss>