Ubuntu - Configure Git to Use Meld for Diffs
By default, git will show you diffs in the CLI in a single view, rather than split view. I'm not elite enough to be able to work this way. This tutorial will show you how to configure git to make use of meld to have a split-pane view of your changes.
Install meld if you haven't already got it. Ubuntu/Debian users can simply run:
sudo apt-get install meld -y
Dixon Dick from the comments pointed out that Mac users can use homebrew to install meld from a tap:
brew install homebrew/gui/meld
After having installed meld, run the following command to configure git to make use of meld.
curl -s https://scripts.programster.org/scripts/9?output=raw | bash
Alternatively, copy,paste, and execute the following bash script to do the same thing.
# Write a script to run meld for git diffs.How to: Meld for Git diffs in Ubuntu Hardy cat << EOF > /tmp/git-meld-diff #!/usr/bin/python import sys import os os.system('meld "%s" "%s"' % (sys.argv, sys.argv)) EOF sudo mv /tmp/git-meld-diff /usr/bin/git-meld-diff # Set the script to be executeable sudo chmod +x /usr/bin/git-meld-diff # configure git to use the new script when we run git diff. git config --global diff.external git-meld-diff
Now when you want to view changes you have made to any files you can run:
or if you just want to view changes in one file:
git diff [filename]