Use customized color for status colorization.
<slot> is one of:
The values of these variables may be specified as in color.branch.<slot> .
So this will work:
Isn't possible: you need to pick one color:
Remember to enable coloring output if it has not been enabled previously:
The command can also take multiple parameters in quotes. This includes two colors (foreground background) from this list:
normal, black, red, green, yellow, blue, magenta, cyan and white;
and it also includes one attribute (style) from this list:
bold, dim, ul, blink and reverse.
So this will work:
Note: with git 2.9.1 (July 2016), The output coloring scheme learned two new attributes, italic and strike. in addition to existing bold, reverse, etc.
It also allow " no- " for negating attributes
Using " no-bold " rather than " nobold " is easier to read and more natural to type (to me, anyway, even though I was the person who introduced "nobold" in the first place). It's easy to allow both.
I have installed git with command:
I even set the username and email in git config using this:
But when I type the command
It shows only these two on the list as:
But in the main reference I saw a lot more in the list, even when configured in windows 8, I configured only this much and got complete list! Does this mean that there is something left to configure? The reference also says "If not configured, Git uses your system’s default editor". How can I figure out if everything is OK, or it still needs to be configured?
asked Mar 28 '16 at 19:02
No, a default installation and only specifying user.name and user.email. you will only have those two options list. Take a look at the documentation on where these values are pulled:
If not set explicitly with --file, there are four files where git config will search for configuration options:
System-wide configuration file.
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or empty, $HOME/.config/git/config will be used. Any single-valued variable set in this file will be overwritten by whatever is in
/.gitconfig. It is a good idea not to create this file if you sometimes use older versions of Git, as support for this file was added fairly recently.
User-specific configuration file. Also called "global" configuration file.
Repository specific configuration file.
Take a look at the options. Most have defaults or default behavior that git will take if not specified.
To answer your question, you should have a usable configuration even with those couple specified.
Is there a way to color output for git (or any command)?
The output looks the same, but the information is totally different: the file has gone from unstaged to staged for commit.
Is there a way to colorize the output? For example, files that are unstaged are red, staged are green?
Or even Changes not staged for commit: to red and # Changes to be committed: to green?
Working in Ubuntu.
EDIT: Googling found this answer which works great: git config --global --add color.ui true .
However, is there any more general solution for adding color to a command output?
I think it might be worth putting git config --global color.ui auto (@Evgeny 's answer) at the top of yours. I think that's likely to be what most people are looking for. I've upvoted both. I'm just saying, for the sake of the internet as it comes here, I think a lot of people just want that simple one liner. All the better if they get it, plus your extra goodness. – msouth May 17 '15 at 3:06
This worked perfectly for me - in the [color "status"] section I added branch = yellow. – Wayne Werner Oct 26 '16 at 17:06
You probably want to use
The auto part says that git will only try and use color on terminals that support it, and you will not get ANSI sequences if you redirect output of git commands to a file for example. Setting it to true is same as auto. and this is also the default since Git 1.8.4.
The color.ui is a meta configuration that includes all the various color.* configurations available with git commands.
This is explained in-depth in git help config .
Git projects can be configured at the system,user or project level.
Set the user and email for git projectSet Git UI Colors
Color code the output using the default colors
Allowed Color: normal, black, red, green, yellow, blue, magenta, cyan, or white .
For the styling we can choose from the following " bold, dim, ul, blink, and reverse ".
If two colors are given the first is the foreground and the second is the background. see stackoverflow for color detail.
Set the editor to be used for editing git related task such as adding commit messages. By default, Git uses whatever you’ve set as your default text editor ($VISUAL or $EDITOR) or else falls back to the vi editor to create and edit your commit and tag messages. To change that default to something else, you can use the core.editorConfiguration File
The configuration files are located at different locations based on the configuration level. System Wide Config
/.gitconfig file looks like below
Written by eranga bandara