{"id":13601552,"url":"https://github.com/dgutov/diff-hl","last_synced_at":"2025-05-14T22:07:07.445Z","repository":{"id":3709677,"uuid":"4781389","full_name":"dgutov/diff-hl","owner":"dgutov","description":"Emacs package for highlighting uncommitted changes","archived":false,"fork":false,"pushed_at":"2025-05-10T22:53:38.000Z","size":39409,"stargazers_count":976,"open_issues_count":16,"forks_count":48,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-12T05:02:41.744Z","etag":null,"topics":["emacs","git","git-gutter","gutter","mercurial","vcs","version-control"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sugarcrm/examples","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgutov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"dgutov"}},"created_at":"2012-06-25T12:28:23.000Z","updated_at":"2025-05-07T20:37:24.000Z","dependencies_parsed_at":"2024-01-27T01:44:38.181Z","dependency_job_id":"a77586a6-61c4-47ab-b95e-240a7393ce6f","html_url":"https://github.com/dgutov/diff-hl","commit_stats":{"total_commits":351,"total_committers":30,"mean_commits":11.7,"dds":"0.18518518518518523","last_synced_commit":"65a5de16e21c87b7c12a78a63fc3b57e07c03c86"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgutov%2Fdiff-hl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgutov%2Fdiff-hl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgutov%2Fdiff-hl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgutov%2Fdiff-hl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgutov","download_url":"https://codeload.github.com/dgutov/diff-hl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254235695,"owners_count":22036963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","git","git-gutter","gutter","mercurial","vcs","version-control"],"created_at":"2024-08-01T18:01:04.394Z","updated_at":"2025-05-14T22:07:02.423Z","avatar_url":"https://github.com/dgutov.png","language":"Emacs Lisp","funding_links":["https://github.com/sponsors/dgutov"],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"About\r\n=====\r\n\r\n`diff-hl-mode` highlights uncommitted changes on the side of the window (area\r\nalso known as the \"gutter\"), allows you to jump between and revert them\r\nselectively.\r\n\r\nIn buffers controlled by Git, you can also stage and unstage the changes.\r\n\r\nFor the usage instructions and the list of commands, see the Commentary section\r\ninside the file.\r\n\r\nTested with Git, Mercurial, Bazaar and SVN. May work with other VC backends, too.\r\n\r\nThe package also contains auxiliary modes:\r\n\r\n* `diff-hl-dired-mode` provides similar functionality in Dired.\r\n* `diff-hl-margin-mode` changes the highlighting function to\r\n  use the margin instead of the fringe.\r\n* `diff-hl-amend-mode` sets the reference revision to the one before\r\n  recent one. Also, you could use `diff-hl-set-reference-rev` to set\r\n  it to any revision, see its docstring for details.\r\n* `diff-hl-flydiff-mode` implements highlighting changes on the fly.\r\n* `diff-hl-show-hunk-mouse-mode` makes fringe and margin react to\r\n  mouse clicks to show the corresponding hunk. That's the alternative\r\n  to using `diff-hl-show-hunk` and friends.\r\n\r\nUsage\r\n=====\r\n\r\nPut this into your init script:\r\n\r\n```lisp\r\n(global-diff-hl-mode)\r\n```\r\n\r\nYou must also ensure that VC is enabled (e.g. `vc-handled-backends` is\r\nnot nil).\r\n\r\nCheck out the Commentary section in each file for more detailed usage\r\ninstructions.\r\n\r\nScreenshots\r\n=====\r\n\r\ndiff-hl-mode\r\n-----\r\nTop window: a buffer in this minor mode, bottom window: the corresponding diff.\r\n\r\n![screenie](screenshot.png)\r\n\r\ndiff-hl-dired-mode\r\n-----\r\n\r\n![screenie](screenshot-dired.png)\r\n\r\ndiff-hl-margin-mode\r\n-----\r\n\r\n![screenie](screenshot-margin.png)\r\n\r\nRequirements\r\n=====\r\n\r\nEmacs 25.1+.\r\n\r\nNotes\r\n=====\r\n\r\n* By default `diff-hl-mode` only updates the display when the buffer is in\r\n  saved state. For a different tradeoff, try `diff-hl-flydiff-mode`, which\r\n  updates the buffer on a timer.\r\n\r\n* To use an\r\n  [alternative diff algorithm](http://stackoverflow.com/questions/32365271/whats-the-difference-between-git-diff-patience-and-git-diff-histogram)\r\n  with Git, add a corresponding argument to `vc-git-diff-switches`,\r\n  e.g. `(setq vc-git-diff-switches '(\"--histogram\"))`. Using the\r\n  `diff.algorithm` option doesn't work\r\n  [because](http://article.gmane.org/gmane.comp.version-control.git/294622)\r\n  `vc-git-diff` calls `git diff-index`. `diff-hl-flydiff-mode` does\r\n  not support alternative algorithms, because it uses the external\r\n  `diff` program.\r\n\r\n* We conflict with other modes when they put indicators on the fringe,\r\n  such as [Flycheck](https://github.com/flycheck/flycheck). This is\r\n  rarely a significant problem, since if you're using such a mode,\r\n  you'd usually want to fix all errors and warnings before continuing,\r\n  and then the conflicting indicators go away.\r\n\r\n* There's no fringe when Emacs is running in the console, but the navigation\r\n  and revert commands still work. Consider turning `diff-hl-margin-mode` on,\r\n  to show the indicators in the margin instead.\r\n\r\n* Frame-local and buffer-local values of `line-spacing` are not supported.\r\n\r\n* Fringe width up to 16 works best (because we can't define a bitmap\r\n  with width above that number).\r\n\r\n* [emacs-git-gutter](https://github.com/syohex/emacs-git-gutter) shows\r\n  indicators in the margin by default, allows you to customize how the\r\n  indicators look more easily. But it misses some of the other features,\r\n  such as the Dired integration.\r\n\r\nIntegration\r\n=====\r\n\r\nIf you're using some package other than `vc` to commit changes, it might\r\nnot run `vc-checkin-hook` after commits. In that case, you'll need to\r\neither add `diff-hl-update` to the hook it does run, or advise some\r\nfunction that's called in the buffer after its state has changed.\r\n\r\npsvn\r\n-----\r\n\r\n```lisp\r\n(advice-add 'svn-status-update-modeline :after #'diff-hl-update)\r\n```\r\n\r\nMagit\r\n-----\r\n\r\nIf you're using a version before 2.4.0, it defines `magit-revert-buffer-hook`\r\n(or `magit-not-reverted-hook`), which we use.\r\n\r\nWhen using Magit 2.4 or newer, add this to your init script:\r\n\r\n```lisp\r\n(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)\r\n```\r\n\r\nTramp\r\n-----\r\n\r\n`diff-hl` should just work with Tramp. But slow or high latency\r\nconnections can cause performance problems. If you experience such\r\nissues, customize `diff-hl-disable-on-remote` to `t`. This will change\r\nthe behavior of both `turn-on-diff-hl-mode` and `global-diff-hl-mode`\r\n(whichever you prefer to use).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgutov%2Fdiff-hl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgutov%2Fdiff-hl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgutov%2Fdiff-hl/lists"}