0

possible duplicate : watch command not showing colors for 'git status'

running the following command: watch -n1 git --no-pager log --oneline --graph -20

reproduces what i expect only it strips colors. In the possible duplicate it says that git detects that stdout is not terminal and hence strips the colors but the solutions does not work for git log on my machine (osx high sierra, zsh)

note - the following code does give me the everything with colors - i'm just interested if watch can do it too:

while :
do
clear
date
git --no-pager log --one-line --graph --20 
sleep 1
done
2

Rather than always forcing git to color, you can enable color for just one command with a flag:

git log --color

So your command would be:

watch --color -n1 git --no-pager log --color --oneline --graph -20

I'm not sure why the linked answer didn't work, but I hope this works better.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.