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

SourceTree - Diff for one file

Anne WALTER May 21, 2015

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

1 vote
Answer accepted
Tim Crall
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.
May 21, 2015

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.

Anne WALTER May 21, 2015

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

Markus June 18, 2015

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

Tim Crall
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.
June 18, 2015

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

0 votes
Markus June 18, 2015

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.

markus

Tim Crall
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.
June 18, 2015

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.

Markus June 19, 2015

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

0 votes
Balázs Szakmáry
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.
May 21, 2015

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.

Anne WALTER May 21, 2015

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.

Like itziarmj likes this
Balázs Szakmáry
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.
May 21, 2015

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events