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 branc
Git 1.9/2.0 (Q1 2014) will introduce color formatting for git for-each-ref
.
See commit fddb74c from Ramkumar Ramachandra (artagnon):
for-each-ref
: introduce %(color:...)
for colorEnhance '
git for-each-ref
' with color formatting options.
You can now use the following format in for-each-ref:
%(color:green)%(refname:short)%(color:reset)
where color names are described in
color.branch.*
.
With Git 2.15 (Q4 2017), you will be able to turn those colors on or off.
See commit 0c88bf5 (03 Oct 2017) by Jeff King (peff).
(Merged 04 Oct 2017)
provide
--color
option for all ref-filter usersWhen ref-filter learned about want_color() in 11b087a (
ref-filter
: consult want_color() before emitting colors, 2017-07-13), it became useful to be able to turn colors off and on for specific commands. Forgit-branch
, you can do so with--color
/--no-color
.But for
git-for-each-ref
andgit-tag
, the other users of ref-filter, you have no option except to tweak the "color.ui
" config setting. Let's give both of these commands the usual color command-line options.This is a bit more obvious as a method for overriding the config. And it also prepares us for the behavior of "
always
" changing (so that we are still left with a way of forcing color when our output goes to a non-terminal).