Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting color-words option by default on git-show

Tags:

git

It's easy to configure git-diff to enable color-words by default.

How can I equally configure git-show to use color-words by default?

The only option I found so far was to use an alias:

[alias]
sh = show --color-words
like image 989
Wladston Ferreira Filho Avatar asked Jan 28 '16 16:01

Wladston Ferreira Filho


People also ask

How do I enable colors in git?

ui" to "auto" as the first thing after you set " user.name/email " to introduce yourselves to Git. Now the variable defaults to " auto ". So you will see colors by default. Using Ubuntu in 2014, installed git and still had to run git config --global color.

How does git diff change if you add the color words option to the command?

git diff --color-words git diff also has a special mode for highlighting changes with much better granularity: ‐‐color-words . This mode tokenizes added and removed lines by whitespace and then diffs those. Now the output displays only the color-coded words that have changed.

What command should you use to ensure all projects you work on have black and white output in git?

If you've committed whitespace issues but haven't yet pushed upstream, you can run git rebase --whitespace=fix to have Git automatically fix whitespace issues as it's rewriting the patches.


1 Answers

You can use [color "command"]. Here is an example. You need to check what options "show" has.

[color "diff"]
    frag = cyan
    new = green
    commit = yellow
[color "branch"]
    current = green
[color "status"]
    updated = green
like image 199
Oleksandr Kravchuk Avatar answered Oct 13 '22 00:10

Oleksandr Kravchuk