Last Updated: February 25, 2016
·
1.133K
· xero

git live-log bash script

git live log bash script.
i like to run this in it's own terminal window, the graph updates every 15 seconds and give you a nice visual overview of your git repository. the -40 is the number of commits to show. if you omit it, and you have a very large number of commits, the log will cycle off screen. edit it to fit your personal taste / terminal screen size.

credit for the idea goes to ben hoskings' omglog (https://github.com/benhoskings/omglog) i saw him use it in the advanced git class from peepcode, and i though... i could do that in bash, no need for ruby gems. and so it is.

livelog.sh

#!/bin/sh
while true;
do
    clear
    git log \
    --graph \
    --all \
    --color \
    --date=short \
    -40 \
    --pretty=format:"%C(yellow)%h%x20%C(white)%cd%C(green)%d%C(reset)%x20%s%x20%C(bold)(%an)%Creset" |
    cat -
    sleep 15
done

https://gist.github.com/3814469