How to open/view file from previous commit.

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

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 Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

274 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot