Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Rob Bednark July 25, 2013

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:

3333
      2222
      1111

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
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2013

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

Rob Bednark July 25, 2013

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

1 vote
Erich Eichinger March 26, 2014

This would be an incredibly useful feature - I submitted a JIRA feature request for this here https://jira.atlassian.com/browse/SRCTREE-2176

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

0 votes
Rob Bednark July 26, 2013

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
TAGS
AUG Leaders

Atlassian Community Events