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

atlassian-sourcetree, git, git-diff

Solution

This is not possible in SourceTree.

I asked this question here on answers.atlassian.com and found out from an Atlassian employee that the ability to do a diff in the opposite direction is not available, that a diff between commits is always shown in "forward history" order.

Some alternatives:

- Use a different external GUI diff viewer

-or-

- 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)

Problem

How can I do a `git diff` in the opposite direction in the Atlassian SourceTree desktop app? In other words, how do I get SourceTree to do `git diff b a` instead of `git 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, `git diff 1111 3333`). How do I make it do a `git diff` in the other direction, so that it's a diff of changes from 3333 to 1111 (i.e., `git diff 3333 1111`)? (NOTE: this question is specifically about how to do this in the Atlassian SourceTree desktop app, not how to do it in git in general.) Here is a screenshot showing where I selected 2 commits in SourceTree to see the diff

Original source

Related problems