2

When a git push fails due to something like:

! [rejected]        develop -> develop (fetch first)

How would one color this type of error in the terminal?

Fo.
  • 3,752
  • 7
  • 28
  • 44
  • Note: with Git 2.18 (Q2 2.18), you will have a color associated with this type of error in the terminal! See [my updated answer below](https://stackoverflow.com/a/27197704/6309) – VonC May 20 '18 at 23:40

1 Answers1

2

You don't color it with Git itself.
That error message is done on stderr.

Independently of Git, you can try and apply color to stderr.

You have other options at "How to colorify git errors, warnings and fatal messages?".
For instance, the project sickill/stderred is illustrated in this article:

http://hsto.org/getpro/habr/post_images/90e/bfe/8c7/90ebfe8c7452f3f2fb47260720ca78b6.png


Note: with Git 2.18 (Q2 2018, 4 years later), that kind of error message on push will actually be colored!
See more at "How to colorify git errors, warnings and fatal messages?".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250