git diff compare feature branch with unstaged current changes

To compare current unstaged changes vs. another branch feature1, with the ability to line-by-line implement changes using meld:

git difftool feature1 -- .

Why not simply checkout another new branch feature2 and then do

git difftool feature1..feature2

You would rather do the first method because this second command only compares committed changes, causing you to make an excessively large number of commits when you’re not sure which change caused the break in compile or run.

Install meld for git

meld is an extremely useful GUI for two-way and three-way file comparisons as well as directory comparisons. You really are missing out if you aren’t using something like this. To use meld for git difftool and git mergetool, one-time configure:

git config --global diff.tool meld
git config --global merge.tool meld

Install meld for Linux/Windows Subsystem for Linux

For Windows Subsystem for Linux (WSL), you will also need X11 setup for WSL.

apt install meld

Install Meld for Mac

brew install meld

Install Meld for Windows

Consider Windows Subsystem for Linux, or download/install Meld for Windows.




Leave a Comment