Help us understand the problem. What is going on with this article?

Git2.9のキレイなdiffを出すためのconfig

More than 3 years have passed since last update.

Git 2.9 has been released
https://github.com/blog/2188-git-2-9-has-been-released

昨日キレイなDIFFが出せるgit2.9がリリースされました。
homebrewで brew upgrade git な感じでアップグレードすれば2.9は入るのですが、
このキレイなDIFFは標準では有効になってないので、記事にあるとおりに設定を行いましょう。
だいたい以下のような感じのコマンドうてばいいと思います。

下準備:diff-highlightにPATHを通す

まぁ通さずに直接読んでもいいんですが、通しておきましょう。
homebrewでいれるとdiff-highlightさんは↓あたりにいるのでPATHを通しておきましょう。

export PATH=$PATH:/usr/local/Cellar/git/2.9.0/share/git-core/contrib/diff-highlight
export PATH=$PATH:/usr/local/share/git-core/contrib/diff-highlight
修正: バージョン指定ではなく share を参照したほうがよいとのコメントいただきました。ありがとうございました。

いい感じの色になるやつ

$ git config --global pager.log 'diff-highlight | less'
$ git config --global pager.show 'diff-highlight | less'
$ git config --global pager.diff 'diff-highlight | less'

追記: git add -p ( git add --patch ) も対応させるには以下

$ git config --global interactive.diffFilter 'diff-highlight'

いい感じの差分になるやつ

$ git config --global diff.compactionHeuristic true

以上です。あとは普通に git diff すればキレイなDIFFが確認できて幸せやつ。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした