Git diff using meld, a graphical file comparator
14 Sep 2016
- First, install meld (or from source : http://meldmerge.org)
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
4. Insert the following codes :
os.system(‘meld “%s” “%s”’ % (sys.argv, sys.argv))
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.
// 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 :
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
commit 8c9dcaa5424a67ddf20cd453bcb6db4c5b04edbf — copy this
Date: Sat Sep 3 17:49:19 2016 +0800
And then, run the following
git diff [commitA] [commitB]</div><div>