Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 331
Rob Bednark Avatar asked Jan 02 '26 04:01

Rob Bednark


1 Answers

Supposing you need to diff a specific branch from your current branch, the only way is the Berik answer because is not possible to inform branch as second argument.

So this show diff normal order:

git diff branch_abc Makefile

and this show diff on reverse order:

git diff -R branch_abc Makefile

like image 159
SauloAlessandre Avatar answered Jan 04 '26 00:01

SauloAlessandre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!