用gvimdiff来显示diff+我喜欢的

http://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-visual-diff-program



The second method, which I prefer, is to configure the external diff tool via "gitconfig". Here's what I did:

1) Create a wrapper script "git-diff-wrapper.sh" which contains something like

-->8-(snip)--
#!/bin/sh

# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode

"" "$2" "$5" | cat
--8<-(snap)--

As you can see, only the second ("old-file") and fifth ("new-file") arguments will bepassed to the diff tool.

2) Type

$ git config --global diff.external 

at the command prompt, replacing with the path to "git-diff-wrapper.sh", so your ~/.gitconfig contains

-->8-(snip)--
[diff]
    external = 
--8<-(snap)--

Be sure to use the correct syntax to specify the paths to the wrapper script and difftool, i.e. use forward slashed instead of backslashes. In my case, I have

[diff]
    external = c:/Documents and Settings/sschuber/git-diff-wrapper.sh

in .gitconfig and

"d:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

in the wrapper script. Mind the trailing "cat"!



原来有个更简单的方法。。。

http://jeetworks.org/node/90


在.gitconfig文件中添加

  4 [diff]
  5         tool = gvimdiff
  6 [difftool]
  7         prompt = false

然后比如对某一个SHA,要显示这个SHA的diff

git difftool SHA^...SHA


Thanks for this help:)

你可能感兴趣的:(Git,Guide)