View The Git Commit Tree In Terminal

Ubuntu 14.04.2 LTS, Git 1.9.1

Sometimes it’s super-useful to view the Git commit tree right in the terminal on the remote host. This can be achieved in several ways. I’m going to show you how we can get a simple coloured summary output of the state of the repo right in the terminal. Lastly we’ll add an alias to make future requests super-easy.

The Tree

We can use Git’s log feature to dig up old commits and spit them out. We can even do this in a decorative order if we add some parameters. First, let’s see the standard output;

This will give us some expanded output, similar to the following:

As you can see, standard log gives us a detailed view of each commit in the history. While this is useful for some tasks, I’m more interested in getting a quick summary of the repo in a tree-like view, particularly the date, commit and commit message.

Let’s make this pretty by passing in some extra arguments.

Now we get a much nicer, decorative summary of what’s going on in the repo:

Bingo, that’s what we wanted. We can also see at a glance which branch the HEAD is pointing at. Now to add an alias and simplify future summaries!

Adding A Git Alias

We could add this to the repo’s .git/config file, but since we want this alias available at the user level, we’ll edit the file at ~/.gitconfig instead. You can create this if it doesn’t exist; Git will automatically include this file and any aliases it contains; sweet!

Save that and exit. You now have access to the tree alias in Git. You can execute this as simple as:


There are other ways to achieve this, and some admins prefer to get very detailed with the Git log. Hopefully this will be a good starting point for you!


I was born in Johannesburg and grew up on a game reserve in the (former) Transvaal. I've waited tables, cleaned toilets, herded sheep, mended fences, fixed cars, managed horses, dismantled aircraft, driven tractors and played music for a living, among other things. Love: kicking back with ma family. Greatly dislike: Television. Enjoy: reading, especially John Piper and Tolkien. Plus this interweb-net thingy isn't too bad either.

Tagged with: , , ,
Posted in System Admin, Web Development
Loading Facebook Comments ...

Leave a Reply