Git With Meld Diff Viewer on Ubuntu

原文地址:http://wiredforcode.com/blog/2011/06/04/git-with-meld-diff-viewer-on-ubuntu/



Using command line Git with standard diff is workable but not very friendly.You might prefer a split-pane diff viewer like that of your favourite IDE. Theeasiest way to get this working on Debian based Linux distros such as Ubuntuis to use Meld, the open source diff and mergetool.

Begin by installing Meld:

$ sudo apt-get update && sudo apt-get install meld

Once installed, open your favourite text editor and create a file calledgit-diff.sh, using the following content:

1
2
#!/bin/bash
meld "$2" "$5" > /dev/null 2>&1

Save this to a location such as /usr/local/bin, giving it executable rights:

$ sudo mv git-diff.sh /usr/local/bin/
$ sudo chmod +x /usr/local/bin/git-diff.sh

The final step is to open your $HOME/.gitconfig file and add the followingfew lines:

1
2
[diff]
        external = /usr/local/bin/git-diff.sh

The next time you type git diff in a Git project with changes, Meld will belaunched showing you a split-pane diff viewer. Note that you are required toclose the open instance of meld before the next diff viewer is opened.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章