git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Colourise git-branch output

From
Junio C Hamano <junkio@cox.net>
Date
Dec 12, 2006, 10:10 UTC
Message-ID
<7vpsapwhl2.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<457E6C65.4B6D131@eudaptics.com>
Johannes Sixt <J.Sixt@eudaptics.com> writes:
Show 9 quoted lines
> Andy Parkins wrote:
>> This patch chooses green for local, red for remote and bold green for
>> current.
>
> Sorry for chiming in so late, but red and green are usually poor choices
> since red-green color-blindness is surprisingly frequent...
>
> Maybe its sufficient to have just the remote branches (dark-)red, and
> the rest in the default color, with the current branch bold?

Even without red-green blindness issue, I think that makes sense. colored-diff uses green/red for added/deleted but that is shown against the context in plain. A sane thing to do for branch listing would be to show the usual case (i.e. local) in plain and show the remote ones differently.

Something like this on top of Andy's?

If we keep '*' prefix for the current one, I do not see a reason to show it in a different color from other local branches, by the way, but I did not go that far in this patch.

---
diff --git a/builtin-branch.c b/builtin-branch.c
index 7c87b8d..d1c243d 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -23,8 +23,8 @@ static char branch_colors[][COLOR_MAXLEN] = {
 	"\033[m",	/* reset */
 	"",		/* PLAIN (normal) */
 	"\033[31m",	/* REMOTE (red) */
-	"\033[32m",	/* LOCAL (green) */
-	"\033[1;32m",	/* CURRENT (boldgreen) */
+	"",		/* LOCAL (normal) */
+	"\033[32m",	/* CURRENT (green) */
 };
 enum color_branch {
 	COLOR_BRANCH_RESET = 0,
Previous: Johannes SixtNext: Andy Parkins
Message 3 of 6 in “Colourise git-branch output”
  1. Colourise git-branch outputAndy Parkins, Dec 12, 2006
  2. Johannes SixtDec 12, 2006
  3. Junio C HamanoDec 12, 2006
  4. Andy ParkinsDec 12, 2006
  5. Junio C HamanoDec 12, 2006
  6. Junio C HamanoDec 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.