LoginSignup
20
19

More than 5 years have passed since last update.

コマンドラインでのgitの色設定

Last updated at Posted at 2015-11-07

MacのTerminalで、gitを実行したときの色設定を複数のMacで統一したかったので、設定内容をちょっとぐぐってみた。

自動的に色を設定する

何も考えずに設定するなら以下を実行すればOK

git config --global color.ui true

.gitconfigに直接記述するなら以下。

[color]
  ui = auto

各コマンドで色分けする

自分が困ってたケースだと、git statusを実行したときの色設定に差異があったこと。
以下のように.gitconfigに記述することで明示的に色を設定することができる。

[color "status"]
    added = yellow
    changed = green
    untracked = cyan

参考

Git - Git の設定
https://git-scm.com/book/ja/v1/Git-%E3%81%AE%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4%E3%82%BA-Git-%E3%81%AE%E8%A8%AD%E5%AE%9A

How to color the Git console in Ubuntu? - Stack Overflow
http://stackoverflow.com/questions/10998792/how-to-color-the-git-console-in-ubuntu

20
19
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
19