{"id":16915853,"url":"https://github.com/tysonandre/git-diff-syntax-highlight","last_synced_at":"2026-05-13T07:36:02.184Z","repository":{"id":75022463,"uuid":"239331405","full_name":"TysonAndre/git-diff-syntax-highlight","owner":"TysonAndre","description":"git pager with syntax highlighting for diffs","archived":false,"fork":false,"pushed_at":"2020-02-09T18:24:23.000Z","size":109,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T18:31:09.750Z","etag":null,"topics":["coderay","color","diff","git","git-diff","ruby","syntax-highlighting"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TysonAndre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-02-09T15:58:53.000Z","updated_at":"2020-02-09T18:24:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"35f14047-f8ad-4969-8733-a752bc3a6471","html_url":"https://github.com/TysonAndre/git-diff-syntax-highlight","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2Fgit-diff-syntax-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2Fgit-diff-syntax-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2Fgit-diff-syntax-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonAndre%2Fgit-diff-syntax-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TysonAndre","download_url":"https://codeload.github.com/TysonAndre/git-diff-syntax-highlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244688655,"owners_count":20493856,"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":["coderay","color","diff","git","git-diff","ruby","syntax-highlighting"],"created_at":"2024-10-13T19:23:05.174Z","updated_at":"2026-05-13T07:35:57.161Z","avatar_url":"https://github.com/TysonAndre.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-diff-syntax-highlight\n=========================\n\nUtilities to include syntax highlighting in the terminal, for git diffs and other commands.\nThis is a patched version of https://gist.github.com/skanev/0eeb943e3111a1df55fd\nwhich fixes rare bugs I've encountered in that gist.\nIt also patches the syntax highlighting to match my personal preferences.\n\nThis is configured to highlight ruby, C, C++, Clojure, CSS, ERB, Go, Java, JavaScript, JSON, PHP, Lua, Python, SASS, SCSS, SQL, XML, and YAML files.\n\n![Demo](images/git_diff.png)\n\nScripts\n-------\n\n- `git-diff-syntax-highlight.rb` - A syntax highlighter for git diffs.\n- `colorless` - Like `less filename.extension`, but with syntax highlighting.\n- `coderay_colorize` - Like `cat filename.extension`, but with syntax highlighting.\n\nKnown Issues\n------------\n\n- RVM can break this when switching to a different ruby version.\n- Highlighting using background colors is poorly handled and result in code that are hard to read.\n  This may be fixable by ensuring some minimum contrast when generating color codes.\n- At the time of writing, there is no support for Markdown in `coderay`, which this depends on\n\nDependencies\n------------\n\nThis requires that `term-ansicolor` and `coderay` be installed, and that ruby be set up.\n\n```\ngem install --user term-ansicolor coderay\n```\n\nColorizing Git diffs\n--------------------\n\n\nAdd the following to .gitconfig.\n\nThe `simple-log`, `simple-diff`, and `simple-show` aliases are provided because syntax highlighting is slow for projects with long histories,\nand because changes in rvm paths can break diffs completely.\n\n```\n[core]\n    pager = /path/to/git-diff-syntax-highlight.rb --highlight | less -F -X\n    # The -F -X is optional.\n    # In addition to --highlight, --coderay-colors may be used to change the syntax highlighting.\n```\n\n\nThe `git-simple-*` scripts are found in [./bin](./bin).\nAfter adding those to a directory the shell's `$PATH`, you probably also want to create aliases for the original diffs.\n\n```\n[alias]\n\tsimple-log = !git-simple-log\n\tsimple-diff = !git-simple-diff\n\tsimple-show = !git-simple-show\n```\n\nSimilar Projects\n----------------\n\nhttps://github.com/dandavison/delta is a similar project written in Rust, with more themes and configuration options.\n\nhttps://github.com/sharkdp/bat is similar to the `colorless` script this provides, with more themes.\n\nhttps://github.com/trishume/syntect is the library those Rust projects use. I'd expect it to have faster startup times and better performance on long diffs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonandre%2Fgit-diff-syntax-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftysonandre%2Fgit-diff-syntax-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonandre%2Fgit-diff-syntax-highlight/lists"}