How to open/view file from previous commit.

banjobum October 12, 2015

I know this is simple for anyone who's been using ST for a while. And I know the answer must be very simple. But I've just spent an hour clicking around and not getting anywhere. An earlier answer to a similar question says to hit <space> or right click then hit <Quick-Look>. Yet it doesn't even tell you what page to be on and what state that page must be in to do these steps. Besides, I'm a top down kind of person. I don't just want instructions for which buttons to push. I want to understand what I'm doing and why.

I greatly appreciate the thousands of hours of effort that has certainly gone into Source Tree and Bitbucket. The few commands that I can confidently use are very helpful. But it is frustrating not really understanding the overall nature of the software, the elements that make it up and how to relate to those elements as a user -  nor can a find any resources here that explain this in a straightforward way. Most help seems to be aimed at those who thoroughly understand Source-Tree and Bitbucket and who want to do more advanced things with it.

BTW, I'd gladly volunteer some time to produce help docs for rank beginners like me once I can get past this level myself.

1 answer

0 votes
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.
October 12, 2015

To open/view a file from a previous commit, you first have to "check out" that commit.

There are multiple ways to do this in SourceTree, but the easiest is to double click on the commit in the graph (in the Log View). 

If you are checking out a past commit, you should see a warning message telling you that you have a detached HEAD.  This just means that your HEAD pointer is not pointing at the tip of a branch, so you won't be able to commit any changes you make unless you create a new branch.  If you're just wanting to review the old code, this is fine.

Once you've checked out the previous commit, you should see that commit is now bold and has the HEAD tag pointing at it.  Your working directory has now been changed to reflect that version of the code.  You can now browse the contents of your files either through SourceTree (click View->File Status View and then select 'All files') or externally using any utility of your choices (because the actual files in the working directory have been set to the historical version).

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events