I have been trying to create an automatically updating git log --graph --no-pager
. I made some strides using fswatch
but I ran into the issue of my git history being actually bigger than my screen can display. I tried adding | head -n $((`tput lines` - 1))
but the output is still overflowing because of line wrapping. I then tried using tput rmam
in order to disable wrapping, but now I can't usually see where HEAD
points to.
Anyone could help me? Ideally, I'd like to remove --no-pager
, but I don't know how to make that work with fswatch
. Here is what I have so far:
function gwatch() {
tput rmam
location=$(git rev-parse --show-toplevel)
clear;
git --no-pager graph --color | head -n $((`tput lines` - 1));
tput smam
fswatch -or $location/.git | while read MODFILE
do
tput rmam
clear;
git --no-pager graph --color | head -n $((`tput lines` - 1));
tput smam
done
}