git-diff-blame
git-diff-blame copied to clipboard
Only colorize output when stdout is a tty.
This makes the output suitable for programmatic consumption. In my case, I was interested in what commits didn't contribute to a given branch's diff, so I tried a git-diff-blame master | grep '^ [-+]'. This didn't work but I couldn't see why -- then I noticed the ANSI escape sequences weren't matching ^ .
Anyway thanks for git-diff-blame! Exactly what I was looking for.
Doesn't this break git diff-blame | less -r? I like the suggestion, but then diff-blame should automatically page (using e.g. less -r) in a TTY.