View differences of branches with meld?

2019-01-08 03:01发布

I know that I can view the difference between HEAD and current state with meld .. But how can I view the differences between branches, for example master and devel with meld?

At the moment I do the following steps:

  1. Rename folder of working copy
    For example mv /projectA /projectA_master)
  2. Clone the project again
    git clone url
  3. Switch to devel branch
    cd projectA && git -b devel origin/devel
  4. View differences with meld
    meld /projectA_Master projectA

Isn't there an easier way to get the same result in meld? I only need it to review the changes and not primarily for merging.

9条回答
狗以群分
2楼-- · 2019-01-08 03:41

In git V1.7.9 you can compare two commits without the commandline:

You must configure in 'git gui' edit options, global: "Use merge tool: meld".

Start gitk, select a commit, right click another commit > "diff this --> selected". Under 'patch' right click a file > "external diff".

meld will start and display the still selected, first commit on the right side.

查看更多
乱世女痞
3楼-- · 2019-01-08 03:43

I cannot comment under Piort Jurkiewicz answer to the comment of pykiss : "copy new files from branch to working dir does not work :( ", but :

The solution to copy file.txt from branch_B into the working branch branch_A is :

git chechout branch_B -- file.txt

from this answer to this question. I dont know how to do it within meld itself.

查看更多
太酷不给撩
4楼-- · 2019-01-08 03:43

I also found this issue annoying so I've made git meld which allows a more comfortable way of diffing arbitrary commits against the working tree or the staging area. You can find it at https://github.com/wmanley/git-meld . It's a bit like Mark's script but works for comparing any arbitrary commit or the staging area or the working directory against any of the others. If one of the things you are comparing against is the working tree then that is read-write also so you don't lose your changes.

查看更多
登录 后发表回答