git diff compare feature branch with unstaged current changes

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

We 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

  1. one-time configure:

    git config --global diff.tool meld
    git config --global merge.tool meld
  2. Install Meld

    • Linux: apt install meld
    • Mac: brew install meld
    • Windows