SourceTree - Diff for one file

Is there a way in SourceTree to compare one given file between two branches?

Using a command line, it would be:

git diff <one_branch> <another_branch> <my_file>

3 answers

1 accepted

0 votes
Answer accepted

You can select any two commits (using CNTRL-click or CMD-click) to do a diff between them.  The just select the file from the list in the lower left corner that you want to see the differences on.

Yes, this is what I was looking for. Thanks.

but this only compares to the last checked out/working version, or do i miss something?

If you use Control-click (or Command-click) on a Mac, you can select any two arbitrary commits and it compares between them.

There is no way to do this form the SourceTree UI.

The closest you can get to this: You can use the "Log selected" option from the context menu that comes up when right-clicking a file name to display the history of the file in the current branch. Within this, if you select two states, it gives you a diff between them. Unfortunately, this only works within one branch.

Thanks for your quick answer. Generally speaking, I really miss in SourceTree a "Diff..." menu, allowing to compare the selected file to another commit/tag/branch of that file.

The same thing seems to work between branches as well in the File history window of Git Extensions.

yes: Please!

i am switching from cornerstone (svn) to sourcetree. what i really miss is an easy way to compare two versions of a file. cornerstone has a really great history/log view even on a single file.


See my accepted answer above - you can easily do this by selecting two commits at thes ame time (using CNTRL-click or CMD-click) and then selecting the file you are interested in in the lower left corner file listing.

your are right. that works. i must have missing something with my first tests. thank you

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,231 views 4 2
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