How do I prettily print out a git-diff output?

Use aha. You can install it in ubuntu with sudo apt-get install aha. Also see https://github.com/theZiz/aha.

$ git diff --color-words | aha > index.html
$ firefox index.html

Firefox should then be able to print it in color. Check out aha --help for some other cool options.


I just tried an npm package hosted on Github: pretty-diff

You install it via npm and run it as you would with git-diff, for example:

pretty-diff HEAD^

A new browser window opens and you can save it as html. I've tried to open it again in a different browser and colors are still showing. You can also use your github account to create gists and share them.


Since you are using a Mac with the terminal application, it is as simple as cut and pasting from the terminal to another application.