How can I see a merge's diff to the other parent?
Asked by Andr? Neves:

When viewing a merge commit in Source Tree, it shows me the diff to the "primary" parent.

How can I view the diff to the "secondary" parent?

I can do it in TortoiseGit, but I can't find out how to do it in Source Tree...

There is an option "Show file changes from all sides of a merge" under "Options" \> "Git", but that one will show both diffs together, which is unhelpful.

Is it possible to see the diff to the one parent and the other, separately?

Here is how the UI of TortoiseGit does it:

sample of diff to two parents.png  
[](https://community.atlassian.com/t5/Sourcetree-questions/How-can-I-see-a-merge-s-diff-to-the-other-parent/qaq-p/390361?attachment-id=8409){#link_11744a48697120}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/11641/1/sample%20of%20diff%20to%20two%20parents.png){#display_11744a48697120_0}  
[](https://community.atlassian.com/t5/Sourcetree-questions/How-can-I-see-a-merge-s-diff-to-the-other-parent/qaq-p/390361?attachment-id=8410){#link_11744a48697120_0}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/11641/2/complex%20repository%20tree.PNG){#display_11744a48697120_2}


Answers:
author: Roman Starkov
body: Turns out this is very simple but not obvious. You just need to select *both* the merge commit and the parent you wish to diff against (using Ctrl/Cmd+click).

What *is* unfortunately missing from SourceTree is git's default behaviour for "git show \<merge-commit\>", which is to omit files that agree with either of the parents. This is a really good way of looking at merge commits that isn't currently available in SourceTree.

comments: author: Andr? Neves
body: This is a useful work-around. But it's not practical and it allows for a relatively high chance of human error.

First I would need to navigate a complex commit tree looking for the parent commit.  
I might confuse the branches (the different colours help, but are not bulletproof).  
Or I might miss the commit and find the grandparent-2 instead of the parent-2.

Then I would need to manually check the diff, for each of the merges; instead of simply clicking the merge's node to see the diff. This is cumbersome, if I want to inspect more than just that particular merge-commit.

And then, if I want to continue inspecting the tree, I need to navigate back to the merge commit to continue.

All these actions are relatively easy with a simple tree... but not really practical on a repository with more than half a dozen contributors.

See the attached image for a sample of the complexity of the repository:

complex repository tree.PNG

I am also attaching an image to the question with an example of an application that shows the diff to the two parents.  
Do you see why I find that option much more practical, straightforward, and less error-prone?


author: armujahid
body: git show support was requested here. Please upvote this.  
Support reviewing merge commits (git show \<merge-commit-hash\>)  
<https://jira.atlassian.com/browse/SRCTREEWIN-8959>


author: Bal?zs Szakm?ry
body: Unfortunately, the "Show file changes from all sides of a merge" is the best solution SourceTree offers for this problem.


author: Seth
body: You can view the diff either way in the diff panel by using the options at the bottom of the diff gear dropdown:

image2016-7-18 9:20:40.png  
[](https://community.atlassian.com/t5/Sourcetree-questions/How-can-I-see-a-merge-s-diff-to-the-other-parent/qaq-p/390361?attachment-id=11241){#link_11744a69eb2299}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/11645/1/image2016-7-18%209%3A20%3A40.png){#display_11744a69eb2299_0}  
[](https://community.atlassian.com/t5/Sourcetree-questions/How-can-I-see-a-merge-s-diff-to-the-other-parent/qaq-p/390361?attachment-id=11242){#link_11744a69eb2299_0}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/11645/2/image2016-7-18%209%3A20%3A14.png){#display_11744a69eb2299_2}

comments: author: Andr? Neves
body: That option only affects the selected file.  
It doesn't change the list of files.

So, if I merge e.g. the feature branch "add print version to reports page" (parent 2) into the branch development (parent 1):

* The diff shows me as changed the files for reporting;
* But if I choose to see the diff to parent 2 using the way you say, I should see in the list of affected files the files changed in the development branch, but instead I see the same list of files, and for each of them I see an empty diff.

:question: Does this make sense?


author: Seth
body: Yeah, good point.


Tags: merge