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.
Opening file version at commit
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?
@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.
Not that I am aware of. Related enhancement request: https://github.com/sublimehq/sublime_merge/issues/125
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.
@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) .
Thank you for your replies, I believe this was added in the latest build and that solves my issue
To help anyone searching in the future, what are the steps you found that work to solve your issue?
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:
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?
Sorry to bump an old issue.
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:
- 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;
- 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)?