Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

meld

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.

like image 772
ftravers Avatar asked Mar 10 '11 04:03

ftravers


People also ask

What is meld in git?

Meld is a visual diff and merge tool targeted at developers. Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and supports many version control systems including Git, Mercurial, Bazaar, CVS and Subversion.

How do you resolve a merge conflict with meld?

The only change you have to make is to change the path of the Meld installed file for Mac or Linux. After setting up defaults, you can type `git difftool` within the Git local directory to launch the Windows version of Meld, or you can `git mergetool` to resolve merge conflicts as shown below.


1 Answers

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:

  • View differences of branches with meld?

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
like image 156
Mark Longair Avatar answered Sep 29 '22 18:09

Mark Longair