Search code examples
gitmeld

how to use meld for reviewing remote changes. Using git as dvcs


I'm using GIT as my DVCS, on Ubuntu 10.04. Simply running:

meld .

in your current working directory is awesome...shows what are the diffs from your working folder to last commit.

I'd like to be able to do the same thing in other circumstances. Say I want to review the changes after I've fetched a remote branch? How would I do that? How can I review the differences with meld between two local branches... I'd love to know if there was a relatively simple way to do that.

Thx.


Solution

  • If you like meld for comparing files and resolving merges, you should probably set the config options diff.tool and merge.tool to meld, e.g.

    git config diff.tool meld
    

    You can then use git difftool master origin/master to view the differences between your local master and the most recently fetched version of master from origin. However, that will only show the differences one file at a time - you have to exit meld and hit enter to see the changes in the next file. If you'd like to see all the differences between two branches in meld, using its recursive view, there's not a one-line way of doing that, I'm afraid.

    However, I wrote a short script in answer to a very similar question that takes two refs (e.g. two branches), unpacks them to temporary directories and runs meld to compare the two:

    Anyway, if you've just run git fetch you can compare the differences between your master and the version from origin using that script with:

    meld-compare-refs.py master origin/master
    

    ... or compare two local branches with:

    meld-compare-refs.py master topic1