I'm using git for-each-ref
as a git alias to display a branch name and the subject of the last commit on that branch. That said, it's hard to tell where the branch name ends and the commit message subject starts, so I'm trying to colourize the branch name to more easily tell the difference between the two. Below is the working alias without colour:
[alias]
logbranch = for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short) %(subject)'
To add colour, I tried using shell colour escapes (I'm using bash) like so:
[alias]
logbranch = for-each-ref --sort=-committerdate refs/heads/ --format='[\033[0;31m]%(refname:short)[\e[m] %(subject)'
which gives me a git config error. I also tried replacing the single quotes with double quotes, and escaping the square brackets, but no dice.
Ideas?