Reproduced:
http://blog.csdn.net/yangzhongxuan/article/details/8286771
http://www.cherrot.com/2012/09/let-git-diff-merge-use-gui-tools-like-meld/
programme I
I think Meld is a good GUI tool for Git diff.
SETP 1:ubuntu Install Meld
sudo Install Meld
Step 2:create a shell script named git_meld.sh
Vim ~/bin/ngit-meld.sh
#!/bin/sh meld $2 $5
Step 3:chang git_meld.sh Permissions
chmod +x ~/bin/git_meld. SH
Step 4:config git diff tool
diff. External ~/bin/git-meld. SH
Scenario Two
Search, copy to copy to is not reliable. More of the copy is this program:
Because meld accepts only two parameters, and git diff passes 7 arguments, you need to write a shell script to convert it:
#!/bin/sh
Meld
Save As Git-meld, add executable permissions, and then set git:
Git Config–global Diff.external/path/to/your/git-meld
This way, Git diff will be able to use meld to see it directly.
However, this does not meet my needs. Because I don't want to change the default behavior of Git diff. In fact, GIT provides the command git difftool to do this kind of work, and it's smarter than the method in the citation.
using git difftool (git mergetool)
git difftool and git mergetool are specifically provided to us to use our own tools for diff and merge commands. You can use it as soon as you configure it:
git config--global diff.tool meld #配置默认的difftool
git config--global merge.tool meld #配置默认的mergetool
then enter the command git difftool HEAD head^1 look at it?
Direct comparison of catalogs using meld
Although the use of Git Difftool has basically met my needs, but there is a small problem: if I want to compare the differences between two commits, Difftool can only one file a file comparison, each time you are prompted whether to open this file, and then open the meld to compare, When you close meld, the next diff file is not prompted. This is a waste of efficiency. Can you directly use Meld's directory comparison capabilities?
a search, sure enough, someone wrote the script: Https://github.com/thenigan/git-diffall
can also be downloaded here: Http://files.cnblogs.com/pengdonglin137/git-diffall-master.zip
after the down, make the following configuration:
git config--global diff.tool meld
git config--global alias.diffall/path/to/your/git-diffall
Try git diffall HEAD head^1 now?
Thank you for lxd to share with me, the above configuration will encounter error "Expansion of alias ' Diffall ' failed; ' /xxxx/git-diffall/git-diffall ' is not a git command, the most convenient solution is to create a soft link in one of your path paths, such as:
ln-s/path/to/your/git-diffall ~/bin/git-diffall
then configure
git config--global diff.tool meld #这一行必须配置, otherwise diffall don't know which diff program to use
git config–global alias.diffall git-diffall
Use Meld to do git diff tool