SourceTree: how to do a diff in the opposite direction?

How can I do a diff in the opposite direction in SourceTree? In other words, how do I get SourceTree to do diff b a instead of diff a b?

e.g., if my commits are in this order in my commits pane:


and I select 3333 and 1111, it will show me a diff of changes from 1111 to 3333 (i.e, diff 1111 3333).

How do I make it do a diff in the other direction, so that it's a diff of changes from 3333 to 1111 (i.e., diff 3333 1111)?

Here is a screenshot showing where I selected 2 commits in SourceTree and the corresponding diff:

3 answers

1 accepted

1 vote
Answer accepted

Not a the moment I'm afraid, the diff between commits is always shown in 'forward history' order.

Bummer! :-( Thanks Steve, I appreciate you letting me know! :-)

This would be an incredibly useful feature - I submitted a JIRA feature request for this here

As a workaround, for now I use the commandline solution

git checkout branch1
git merge --no-commit branch1

and preview the potential merge changes in SourceTree

It's not possible, per @Steve_Streeting's answer, but here are some alternatives:

1. Use a different external GUI diff viewer

2. Copy the files from older commit 1111 into the working tree for newer commit 3333, and then see the diffs in the working tree, e.g.,

cd {repo}
git diff --name-only 3333..1111 > /tmp/list_of_files_changed
git checkout 1111
mkdir /tmp/files_changed
cp --parents -pr $(cat /tmp/list_of_files_changed) /tmp/files_changed
git checkout 3333
cp -pr /tmp/files_changed/* .
# (now look at the diff in SourceTree for the working copy)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

22 views 0 0
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you