Is there a way to get a visual diff on two branches in SourceTree?

GitGit BranchAtlassian Sourcetree

Git Problem Overview


Does Sourcetree offer a way to visualize differences between git branches?

I'm looking for:

  • names of files that have changed
  • diffs between these files

Git Solutions


Solution 1 - Git

Use (OSX) or CTRL (Windows and Linux) and choose any two commits you like in log view. It does not matter what branch the commits belong to.

As a result you will see something like...

> Displaying all changes between f03a18bf0370c62bb5fb5c6350589ad8def13aea and 4a4b176b852e7c8e83fffe94ea263042c59f0548

...down below.

Solution 2 - Git

Another way to do this is to right-click on a branch and select the "Diff against current" context menu command (current refers to the branch you are currently working on). This will give you the diff between the head commits of the two branches.

Source: https://answers.atlassian.com/questions/167126/sourcetree-diff-against-current-behavior#

Screenshot (based on Sourcetree v1.9.5):

enter image description here

After choosing "Diff against Current" from the context menu, you should see a message to the effect of:

> Displaying all changes between {commit_hash} and working copy

After choosing to

Solution 3 - Git

You can also do this by ctrl + clicking the two branches commits you want to diff.

Solution 4 - Git

You can also use an External Diff tool. For example I am using Beyond Compare. After you set it as an external diff tool in sourcetree, you select both files you want to compare using CTRL and after that you press CTRL+D. As a result, Beyond Compare will be launched with both files ready to be compared.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSnowcrashView Question on Stackoverflow
Solution 1 - GitAnton GlukhovView Answer on Stackoverflow
Solution 2 - GitGanView Answer on Stackoverflow
Solution 3 - GitTaranView Answer on Stackoverflow
Solution 4 - Gitlsc05View Answer on Stackoverflow