sudo apt-get install meld
2. Then, create a directory named script in home folder
cd ~; mkdir script; cd script;
3. Create a file and name it git_meld.py
touch git_meld.py
4. Insert the following codes :
#!/usr/bin/python
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
5. Save the file.
6. Then, set git to use this script as part of 'diff' command
git config --global diff.external /home/script/git_meld.py
That's it, we're done. Use git diff as the following
// compares working directory with index
// i.e. shows the changes that are not staged yet.
git diff
// compares working directory with local repository.
// shows the list of changes after your last commit.
git diff HEAD
// compares index with local repository.
// shows the diff between your last commit and changes to be committed next (already staged, but not yet commited)
git diff --cached
Full manual available :
https://www.kernel.org/pub/software/scm/git/docs/git-diff.html
If you want to compare between 2 commits, use
git log and then copy the commit ID of the 2 commits you want to compare
i.e.
commit 8c9dcaa5424a67ddf20cd453bcb6db4c5b04edbf --- copy this
Author: Raf
Date: Sat Sep 3 17:49:19 2016 +0800
And then, run the following
git diff [commitA] [commitB]