https://github.com/banister/diff_highlight
Syntax highlight a git diff in the terminal.
https://github.com/banister/diff_highlight
git ruby
Last synced: about 2 months ago
JSON representation
Syntax highlight a git diff in the terminal.
- Host: GitHub
- URL: https://github.com/banister/diff_highlight
- Owner: banister
- License: mit
- Created: 2018-01-22T09:46:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-19T23:00:39.000Z (over 8 years ago)
- Last Synced: 2025-02-26T19:40:59.577Z (over 1 year ago)
- Topics: git, ruby
- Language: Ruby
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# DiffHighlight
(C) John Mair (banisterfiend)
Applies syntax highlighting to a `git diff`. Use as follows:
```
git diff | diff_highlight | less
```
Output:

## Features
* Makes its best guess at the language appearing in the diff and uses appropriate highlighter
* Supports Ruby, Javascript, C, YAML, Rakefiles, CSS, HTML, etc
* Supports multiple languages in the same diff
* Supports streaming input and output
## How to use
This gem provides the `diff_highlight` executable. Just install the gem and the executable should be available :)
Use as follows: `git diff | diff_highlight | less`
Or setup a git alias:
In `~/.gitconfig`:
```
[alias]
diffc="!f() { git diff $@ | diff_highlight | less; }; f"
```
And use like so:
```
git diffc HEAD~2
```
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).