有没有办法为git(或任何命令)上色输出?
考虑:
baller@Laptop:~/rails/spunky-monkey$ git status
# On branch new-message-types
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: app/models/message_type.rb
#
no changes added to commit (use "git add" and/or "git commit -a")
baller@Laptop:~/rails/spunky-monkey$ git add app/models
和
baller@Laptop:~/rails/spunky-monkey$ git status
# On branch new-message-types
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: app/models/message_type.rb
#
输出看起来相同,但是信息却完全不同:文件已从未暂存状态变为已暂存状态以进行提交。
有没有办法使输出着色?例如,未暂存的文件为红色,暂存的文件为绿色?
甚至Changes not staged for commit:
是红色和# Changes to be committed:
绿色?
在Ubuntu中工作。
编辑:Googling找到了这个很好的答案:git config --global --add color.ui true
。
但是,是否还有其他通用的解决方案可为命令输出添加颜色?