For my (Debian Jessie) version of git, the default color for
displaying the commit hash in the "git log" output is yellow.  That is a
bad choice on normal terminals like mine with a white background because
it makes the commit hash (extremely important and useful information)
virtually unreadable.  So I found myself using

git log |less

quite a bit which suppresses the colours, but I finally got tired of
such workarounds today, and started googling for the answer which
turned out to be extremely difficult to find because there are other
aspects of the git log information (especially decoration and pretty
formats) where users are fascinated with setting the color, but all
that information doesn't help for setting the color for the key
information in the log, the commit hash.  Eventually, though I did find
the solution which is to run the following command:

git config --global color.diff.commit "yellow black"

which improved visibility tremendously because that yellow
foreground is now seen against a black background.  Another alternative
with good visibility (at least for my terminal) is

git config --global color.diff.commit red

i.e., red on the terminal background (white for me).

But other foreground and background colors are possible as well. For
my version of git (2.1.4), the only color choices appear to be normal,
black, red, green, yellow, blue, magenta, cyan and white.  However, if
you have git-2.3.0 or later it appears from web commentary that 24-bit
hex colors will be recognized, e.g., '#FF0000' instead of red if you
have a terminal that supports those.

By the way, to those here wondering why the configuration item
color.diff.commit has anything to do with the color of the commit hash
displayed in the git log command, "git help config" does mention the
git log command for the color.diff configuration item so I guess you
can infer that color.diff.commit controls the commit hash color for
git log, but that inference is not completely obvious so that is why I
didn't come up with this solution myself and had to use a long
detailed google search to find it.

I hope this solution helps those here who are currently having trouble
with the visibility of the default yellow color on terminal background
for displays of commit hashes.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to