ステータスD
、M
、およびA
のファイルが異なる色になるように、git diff --name-status
のbash出力をスタイルしたいと思います。`git diff --name-status`のファイルステータスによるbash出力に色を追加する方法は?
一般的なgit bashをスタイルするには、.gitconfig
にcolor
オプションを使用します。
# .gitconfig
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
私は以下のように別名で--pretty=format
を使用することができますgit log
のようなコマンドの出力をスタイルに:
# .gitconfig
[alias]
log = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
はしかし、私はgit diff --name-status
ため--pretty=format
を使用して成功していません。ステータスタイプによって出力git diff --name-status
のスタイルを設定する方法はあり
$ git diff <branch> --name-status
M .gitignore
M README.md
A diagnostic.js
D diagnostic.md
:私はスタイルしたい
出力は、現在、スタイルとのように見えるされていませんか?あなたが本当にあなたの人生に色が必要な場合は
あなたのgitの設定に応じて色付けされますが、それは' gitの状況によく似ています - 色が内蔵された「ショート」。それがあなたのトリックですか? –