Sublime Forum

Opening file version at commit

#1

Is there a way to see the file as it was at a certain commit? I’m able to do this with SourceTree and it’s a quite useful feature.

4 Likes

#2

While you’re looking at a commit, you can click on the tree hash or click on the three dots menu and choose View Tree to see the tree for that commit. Picking a file from the tree list shows you the blame view for the file at that commit. Once you have that open, you can click around in the commit graph to change the selected commit, and the view will show you the contents of the file at that commit.

Is that what you’re looking for?

0 Likes

#3

@OdatNurd But there is no “direct” way to jump to a file at Revision XYZ, correct? I missed this too a while ago while digging through commits for a file relatively deep in a directory structure. Thanks for any hint regarding this.

0 Likes

#4

Not that I am aware of. Related enhancement request: https://github.com/sublimehq/sublime_merge/issues/125

1 Like

#5

Indeed as far as I’m aware there’s no direct way to do that.

There are a variety of ways to get there; the file: term in the search view, using File History or Blame from the command palette, smerge search blah from the command line. They all require some extra interaction to hit what you want, though.

1 Like

#6

@srbs Thanks for the link!

@OdatNurd Thanks for your response! Yes, I manage it in one of the ways you suggested but it feels unhandy somehow (although I have no ‘perfect’ solution suggestion for this workflow yet) .

1 Like

#7

Thank you for your replies, I believe this was added in the latest build and that solves my issue

0 Likes

#8

To help anyone searching in the future, what are the steps you found that work to solve your issue?

0 Likes

#9

In the new build on Windows (Build 1107), in the sidebar at the bottom of the page, you can select ‘Changes’ or ‘Tree’. If you click on ‘Tree’, you’d see the status of all the files at the time of the selected commit. Clicking on any file in the Tree shown opens a blame on the file at the time of the commit. Here’s how it looks like:

0 Likes

#10

The new features allows me to view all files the way they were at a particular commit but I’m a bit limited with what I can do with a file opened in SM. If I right-click on the file and click on ‘Open in Editor…’, it opens the current version of the file. Is there a way to open the file version at that commit?

1 Like

#11

Sorry to bump an old issue. :wink:


I wish SM could create a read-only, temporary file from git show commit:path/file and open it in the editor. Note that commit can be replaced by commit hash or tag or branch name or anything that git understands.

I think I could create a custom command for this. My only two questions are:

  1. how to list all the files in the repo (to let the user choose / filter out the particular file) similarly to how the Command Palette show commands;
  2. similarly, I’d like to list all the branches/tags/commits (for example, in that order) again to let the user choose the particular branch/tag/commit.

Could anyone (maybe @OdatNurd) point me to the right direction? Or maybe is there a way to do this via some kind of plugin (probably ST3 plugin)?

0 Likes

#12

I just posted a workaround as a menu item:

0 Likes

#13

Also, there is an existing issue to watch:

0 Likes