Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
245
Help us understand the problem. What is going on with this article?
@YasuOza

gitのdiffを見やすく表示する

More than 5 years have passed since last update.

GitHubのdiffがメソッド名表示されて見やすかったので、ローカルでも出来ないか調べたのでそのメモ。

例えばGitHubのdiffはメソッド名def is_repo?が出る
Screen Shot 2013-11-21 at 7.17.20 PM.png
https://github.com/github/hub/commit/87050ce94a97b0c382b99c975bde0c833332b38e

普通にしてるときのローカルのdiffはこんなかんじ。メソッド名出ない:confounded:
Screen Shot 2013-11-21 at 7.20.04 PM.png

ローカルでもGitHubのようにdiffにメソッド名を出すようにするにはプロジェクトルートに

*.rb diff=ruby

を置けば:ok_hand:

ローカルはこんなかんじなる:heart_eyes:
Screen Shot 2013-11-21 at 7.29.07 PM.png

diffで選択できるパターンは
http://git-scm.com/docs/gitattributes#_defining_a_custom_hunk-header
に掲載されているので、必要に応じて変える。

2013/11/22 13:40 追記

グローバルな.gitattributesを指定したい場合は

~/.gitconfig
[core]
      attributesfile = ~/.gitattributes_global
~/.gitattributes_global
*.rb diff=ruby

のように設定すれば:ok_hand:

245
Help us understand the problem. What is going on with this article?
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
YasuOza
こんにちは

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
245
Help us understand the problem. What is going on with this article?