Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 501
Snowcrash Avatar asked Oct 04 '22 04:10

Snowcrash


People also ask

How do I find the difference between two commits in git?

To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..


2 Answers

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 "Diff against Current" you should see a list of files that have changed, beneath the message "Displaying all changes between {commit_hash} and working copy"

like image 231
Gan Avatar answered Oct 06 '22 18:10

Gan


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.

like image 280
Anton Glukhov Avatar answered Oct 06 '22 16:10

Anton Glukhov