0

What is a good way to browse git commits locally with syntax highlighting?

Basically, I want to do "git diff" between a particular commit a its previous commit, but with syntax highlighting supported.

2
  • for red/green adds/removals you can do git diff --color. I think you might bean code highlighting though. Commented Apr 27, 2013 at 0:02
  • 1
    github.com/bernardofire/githat might work for you. Commented Apr 27, 2013 at 0:03

2 Answers 2

1

All you need is a pager that supports syntax highlighting. Vim could be used for this:

GIT_PAGER="vim -" git diff --no-color ...

--no-color turns off git-diff's own colouring, which would otherwise just show up as clutter (unless you have vim set up to deal with ANSI escape sequences).

The result isn't necessarily perfect, because the output of git-diff obviously isn't valid code in whatever programming language you're using, but it's close and easy.

Sign up to request clarification or add additional context in comments.

Comments

0

There are many options to accomplish this depending on your system (PC, Mac, Linux) but if you're looking for a gui:

Mac: GitX

PC: Git Extensions

Linux: Question already answered here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.