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

蹲街弑〆低调 提交于 2019-12-04 23:42:17

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!