The command git status -s
will output a short-format git status. The status of each file will be colorized, e.g. the M
will be red or green; however, unlike the normal git status
, the files will not be colorized. They appear the default color for your terminal.
Is there a way to colorize the files the same as their status' while still using the short-format output?
This is not directly possible with native git, as the t/t7508-status.sh
test script illustrates:
test_expect_success 'status with color.status' '
test_config color.status always &&
git status | test_decode_color >output &&
test_i18ncmp expect output
'
cat >expect <<\EOF
<RED>M<RESET> dir1/modified
<GREEN>A<RESET> dir2/added
<BLUE>??<RESET> dir1/untracked
<BLUE>??<RESET> dir2/modified
<BLUE>??<RESET> dir2/untracked
<BLUE>??<RESET> untracked
EOF
As you can see, the color is reset right after the short status indicator, and right before the filenames.
Note: the only evolution for now (Git 2.13.x/2.14, Q3 2017) is regarding the branches color.
See commit 75177c8 (27 Apr 2017) by Jeff King (peff
).
See commit 93fdf30 (22 Apr 2017) by Stephen Kent (stevejameskent
).
(Merged by Junio C Hamano -- gitster
-- in commit 3900254, 16 May 2017)
status
: add color config slots for branch info in "--short --branch
"Add color config slots to be used in the status short-format when displaying local and remote tracking branch information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With