Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change color of "Stage this hunk" query in git bash

when doing git add -p in the git bash terminal, the query "stage this hunk" comes up in a very dark blue that is very difficult to see on the black background.
How can I change this to something more easily readable?

enter image description here

like image 825
db_ Avatar asked Sep 02 '25 10:09

db_


1 Answers

Git provides control knobs for the interactive add output:

  • color.interactive: a boolean to decide whether to use color at all
  • color.interactive.header: the color for headers, default bold
  • color.interactive.help: the color for help text, default red bold
  • color.interactive.prompt: the color for queries like "Stage this hunk" (the one you're specifically asking about), default bold blue.

Select any other color as described in the git config documentation. In this link, I included an anchor going to the right section, though git-scm.com sometimes changes how they do their anchors.

You can test out specific choices with:

git -c color.interactive.prompt=<choice> add -p

For instance,

git -c color.interactive.prompt=brightred add -p

works for me. Some details depend on your terminal emulator, but in general the built in colors work; if your emulator supports 24-bit color the #12fe56 style values work too.

(You may or may not also be able to adjust the colors in the terminal emulator, as evolutionxbox suggested in a comment.)

like image 60
torek Avatar answered Sep 04 '25 06:09

torek