git ready

learn git one commit at a time
by Nick Quaranto

text-based graph

committed 26 Jan 2009

Just a short and interesting tip today about git log --graph. If you’re confused about where branches are headed or how merges worked, and you’re either too lazy to fire up gitk, gitx, or the GitHub Network Graph, you can get a really simple and fast graphical representation of your commits with this command.

Doing a git log --graph produces this for my clone of the jekyll repo, which has changes not pushed from yesterday’s post on merging and branching. However, in this form it’s not really helpful:

Let’s slim that down a bit to git log --graph --pretty=oneline --abbrev-commit so we can get commits compressed and only show 7 characters from the SHA1:

Much better! Of course, there’s plenty of other ways to visualize your repository as well.

UPDATE: This command is included only in Git versions 1.5.6 and up.