Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view file contents as it was in a commit - Like `git show`

Briefly: What's the SourceTree equivalent of:

git show 946a759:File.h


More thorougly:

  1. File.h did not change in commit 946a759, I just want to see the contents of the file as it was at the time of that commit.

  2. I do know that I could change the Log View - Working Copy view to show all of my files, find the file in the list, right-click on it and choose "Log Selected", find the commit (or the next oldest one) but

    • That's a cumbersome process
    • I don't want to change the Log View's setup to show all files
    • It's really difficult to find a random file in that huge long list of files.

So what I'd like to do is be in the Log View with my master branch selected in the left sidebar, find the particular commit in the tree, and then do the equivalent of git show rev:AnyFileIWant. I'd be just fine typing in the path to the file.

I can't seem to find a way to do this?

like image 648
seth Avatar asked Jan 21 '16 01:01

seth


1 Answers

It's not possible in SourceTree, however your IDE might be able to do it:

IntelliJ IDEA (and other JetBrains IDEs with integrated VCS)

Right-click your commit in the VCS view (alt + 9) and select Show Repository at Revision.

Show Repository at Revision

A repositories view will pop up right where your project view was. You can now open any file at the time of the revision / commit. Files are read-only.

Repositories view

like image 84
Impulse The Fox Avatar answered Sep 30 '22 18:09

Impulse The Fox