Git

有 git diff 顏色自定義

  • July 21, 2022

怎樣才能將git diff顏色更改為一個人的處置,或者例如為diff…?

在 ~/.gitconfig 中:

[color "diff"]
 added = yellow
 changed = red bold

不行。請真誠的幫助表示讚賞

手冊詳細說明了可用的git-config(1)插槽;您的addedandchanged可能會改為newand old

  color.diff.<slot>
      Use customized color for diff colorization.  <slot> specifies which
      part of the patch to use the specified color, and is one of context
      (context text - plain is a historical synonym), meta
      (metainformation), frag (hunk header), func (function in hunk
      header), old (removed lines), new (added lines), commit (commit
      headers), whitespace (highlighting whitespace errors), oldMoved
      (deleted lines), newMoved (added lines), oldMovedDimmed,
      oldMovedAlternative, oldMovedAlternativeDimmed, newMovedDimmed,
      newMovedAlternative newMovedAlternativeDimmed (See the <mode>
      setting of --color-moved in git-diff(1) for details),
      contextDimmed, oldDimmed, newDimmed, contextBold, oldBold, and
      newBold (see git-range-diff(1) for details).

引用自:https://unix.stackexchange.com/questions/710663