Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In magit, how do I see a diff what a branch adds to my current branch?

Tags:

emacs

magit

In the Magit Refs buffer, you can press tab on a branch (the branch I want to merge in) to see what commits would be added if this branch were merged into the currently checked out branch, and you can press enter on the commits to see their changes. Is there a way to see all those changes unified together?

I don't think the magit diff dwim feature is what I want, because it shows all the changes that are on the current branch but not on the branch I want to merge in. I usually don't care about seeing those changes, because I am mostly interested in what the branch I am merging will change, not everything else that changed.

like image 258
ryantm Avatar asked Oct 04 '16 23:10

ryantm


2 Answers

You can see what a branch will add when merged by using merge preview m p. This can be used from the Magit Refs buffer by navigating point to the branch you want to preview a merge of and typing m p.

like image 171
ryantm Avatar answered Nov 07 '22 09:11

ryantm


Yes, "diff dwim" doesn't really do what I mean here either. That should be improved, open a feature request please.

Meanwhile you can use d r and then type the range (at least with completion). Or you could use d d and then flip the revisions (D f) as well as switch the range style (D r). Together this changes feature..master to master...feature.

like image 10
tarsius Avatar answered Nov 07 '22 09:11

tarsius