4

I assume that it's because of the color setting in my config file, but I've tried changing that to no avail. Maybe I'm not doing that right?

Notice that Git Bash shows branch color in green, but on window cl it's not showing at all!

enter image description here

$ git branch
* add_bower *<~~~ only the asterisk appears on the windows prompt.*
  master
2
  • 2
    You have probably messed up your console colors. Both CMD.EXE and Powershell.exe, as suggested by @neumann1990, use the same "console window" infrastructure, capable of the same color effects. Commented Jan 1, 2016 at 15:58
  • I used this technique: askubuntu.com/a/517678/428049, and guess what! It worked!! Commented May 25, 2017 at 6:52

3 Answers 3

3

git in cmd should work just fine. I would check both your gitconfig local and gitconfig global before giving up here.

the first thing I would do is a

git branch --color

or

git diff --color

you can also use the -c option

git -c color.ui=always status

if you see colors then what is likely happening is your local gitconfig is overriding the setting in your global gitconfig

at that point do a

git config --local --edit

if things say auto or true and you still don't see colors. set the output to always. I recommend this b\c it is possible for git to make mistakes and not treat cmd as a terminal

from git-config:

If this is set to always, git-diff(1), git-log(1), and git-show(1) will use color for all patches. If it is set to true or auto, those commands will only use color when output is to the terminal. Defaults to false.

like so

[color]
    branch = always
    diff = always
    interactive = always
    status = always
    ui = always

hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

1

I don't think the command prompt will support coloring different parts of the output out of the box. You'd probably need some extension or add-on to handle it. Have you considered using Powershell? In addition to the built-in support for the coloring you're looking for, it's also much more versatile and powerful than the normal command prompt. Output with color in Powershell

2 Comments

I'm seeing this problem in some of my command shells. When the current branch text doesn't appear in cmd, running powershell gives the same problem.
Powershell only shows limited colors as well as CMD
0

I'm seeing the exact same problem, only for some command prompts. (By default it works, but when I run my team's "razzle" customization script the output is broken like your screenshot. Oddly, coloring in git log and status works fine; just branch is broken.)

I created a new shortcut that launched the same customization script, and the output is fixed for my new shortcut. Very weird.


If you run git branch --no-color you see the right output, just without color?

You can run git config --local --add color.branch never to set that as the default for this repo.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.