Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
876 views
in Technique[技术] by (71.8m points)

git - View differences of branches with meld?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Short & sweet:

git config --global diff.tool meld

This configures Git to use meld as the diff tool. (You don't need to specify the command line arguments, support for meld is built into Git.)

Then, if you want a graphical diff instead of a textual one, you simply invoke git difftool instead of git diff (they both take the same arguments). In your case:

git difftool master..devel

Update: If you don't want the one-file-at-a-time diff, but instead want to use meld's "subdirectory" view with all the changes between the two branches, note the -d or --dir-diff option for git difftool. For example, when I'm on branch XYZ and I want to see what is different between this and branch ABC, I run this:

git difftool -d ABC

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...