Git: Displaying Commit Tree With NerdTool

P1030408

I was in a private hackathon with ftt and Zero last weekend, coding a new Android Taipei tour guide app, and we were looking for a way to display in real-time our commit tree on a big screen. We ended up using NerdTool to render the commit tree. Not only did the result looks pretty cool, it has also proven to be quite helpful when trying to rebase/merge different branches.

這幾天和 ftt 跟 傑洛 聚在一起 hackthon , 想了一個方法用大螢幕即時顯示 git 的 commit tree,看起來很有趣, 在 merge 不同 branch 的時候也十分實用。 我們用的程式是 NerdTool,它跟 GeekTool 類似, 是一個可以把任一 command 的 output 顯示在桌面上。 我最早是在 LifeHacker 發現的, 最大的差別在 NerdTool 可以正確的顯示 ASCII colors。

NerdTool is an application that allows you to display shell script output on your desktop, and unlike the popular GeekTool, NerdTool support ASCII colors.

P1030409

So we’ve clone an additional copy of our git repo from BitBucket, and set NerdTool to run git pull and git log every five seconds:

我們先從 bitbucket 上另外 clone 了一份 repo 下來專門用來 watch commit 的變動, 接著讓 NerdTool 三秒跑一次 git pull 並用樹狀圖顯示 log 在桌面上:

1
2
3
4
cd ~/.gitwatch/<repo_name> ;
git pull 2>&1 > /dev/null ;
date ;
git logpretty | head -47

Screen Shot 2011-10-30 at 2.11.47 AM

git logpretty is my git alias, setup as following: git 設定的 alias:

1
2
3
4
logpretty = log --abbrev-commit \ 
--decorate --graph --color --date-order \
--pretty= \ 
"format:%Cblue%h\%Cred%an:%Creset\"%Cgreen%s%Cblue\"\ %Creset%ar"

The final result:

gggg