dgutov/diff-hl
dgutov/diff-hl has 1,119 GitHub stars and 71 forks. GitHot measured 0 stars in 24 hours, +1 in 7 days, and +2 in 15 days. Last checked 2026-11-09 13:34 UTC. Last push 2026-10-01.
Emacs package for highlighting uncommitted changes
Measured star growth
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalAbout 
diff-hl-mode highlights uncommitted changes on the side of the window, allows
you to jump between and revert them selectively.
This feature is also known as "source control gutter indicators".
In buffers controlled by Git, you can stage and unstage the changes.
For the usage instructions and the list of commands, see the Commentary section inside the file.
Tested with Git, Mercurial, Bazaar and SVN. May work with other VC backends, too.
The package also contains auxiliary modes:
diff-hl-dired-modeprovides similar functionality in Dired.diff-hl-margin-modechanges the highlighting function to use the margin instead of the fringe.- But if you use a non-graphical terminal, the package will fall back to using
the margins anyway, as long as
diff-hl-fallback-to-marginis non-nil and the margin width is non-zero. diff-hl-amend-modesets the reference revision to the one before recent one. Also, you could usediff-hl-set-reference-revto set it to any revision, see its docstring for details.diff-hl-flydiff-modeimplements highlighting changes on the fly.diff-hl-show-hunk-mouse-modemakes fringe and margin react to mouse clicks to show the corresponding hunk. That's the alternative to usingdiff-hl-show-hunkand friends.
Usage
Put this into your init script:
(global-diff-hl-mode)
You must also ensure that VC is enabled (e.g. vc-handled-backends is
not nil).
Check out the Commentary section in each file for more detailed usage instructions.
Screenshots
diff-hl-mode
Top window: a buffer in this minor mode, bottom window: the corresponding diff.

diff-hl-dired-mode

diff-hl-margin-mode

Requirements
Emacs 27.1+.
Notes
By default
diff-hl-modeonly updates the display when the buffer is in saved state. For a different tradeoff, also enablediff-hl-flydiff-mode, which makes the updates happen on a timer.To use an alternative diff algorithm with Git, add a corresponding argument to
vc-git-diff-switches, e.g.(setq vc-git-diff-switches '("--histogram")). Using thediff.algorithmoption doesn't work becausevc-git-diffcallsgit diff-index.diff-hl-flydiff-modedoes not support alternative algorithms, because it uses the externaldiffprogram.We conflict with other modes when they put indicators on the fringe, such as Flycheck. This is rarely a significant problem, since if you're using such a mode, you'd usually want to fix all errors and warnings before continuing, and then the conflicting indicators go away.
There's no fringe when Emacs is running in the console, but the navigation and revert commands still work. Consider turning
diff-hl-margin-modeon, to show the indicators in the margin instead. It also helps avoid the conflict with Flycheck/Flymake even on graphical frames.Frame-local and buffer-local values of
line-spacingare not supported.Fringe width up to 16 works best (because we can't define a bitmap with width above that number).
Integration
If you're using some package other than vc to commit changes, it might
not run vc-checkin-hook after commits. In that case, you'll need to
either add diff-hl-update to the hook it does run, or advise some
function that's called in the buffer after its state has changed.
psvn
(advice-add 'svn-status-update-modeline :after #'diff-hl-update)
Magit
If you're using a version before 2.4.0, it defines magit-revert-buffer-hook
(or magit-not-reverted-hook), which we use.
When using Magit 2.4 or newer, add this to your init script:
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
Tramp
diff-hl should just work with Tramp. But slow or high latency
connections can cause performance problems. If you experience such
issues, customize diff-hl-disable-on-remote to t. This will change
the behavior of both turn-on-diff-hl-mode and global-diff-hl-mode
(whichever you prefer to use).
Explore related projects
codecrafters-io/build-your-own-x
Master programming by recreating your favorite technologies from scratch.
561,343 starspublic-apis/public-apis
A collective list of free APIs
497,588 starsmorluto/rea
Reverse engineer anything with agents, from app behavior down to native binaries.
446,687 starsopenclaw/openclaw
The AI that really does things. Any OS. Any Platform. The lobster way. 🦞
394,252 stars