When viewing a commit page, GitHub provides a link to view each file. The link points to the file at the current commit. Example.

However, sometimes we want to view the version of a file _before the commit was made_.
For the longest time I have been doing this manually, by clicking "view file" and then editing the URL to add a ^ at the end of the commit (to reference the parent commit).
It would be very useful if this was added as a link in the menu, so we don't have to resort to hacking the URL like this.
This would also be useful in PRs, where GitHub similarly shows a "view file" link for each file in the diff. Sometimes we want to view the version of a file _before all of the commits in this PR_.

For the longest time I have been doing this manually, by clicking "view file" and then editing the URL to add a
^at the end of the commit (to reference the parent commit).
What about an alt-click to go to the parent commit?
Sometimes we want to view the version of a file _before all of the commits in this PR_.
I think this would make sense as its own button. Also it would need to handle files created with this pr.
@yakov116 That would work, although it's less discoverable.
I find the lack of this really annoying. Is it possible that there’s no path to that page? I think it’s at least 3 clicks/pages away, which isn’t good.
Suggestions welcome. Alt-click isn’t ideal in this case.
Is it possible that there’s no path to that page?
Isn't it just as simple as replacing the commit param in the URL with the following?
${COMMIT}^My question was: how is it possible that GitHub didn’t add this feature? Is there any other non-obvious way to reach that page?
I’m not talking about “how to fix it,” because as you said it’s pretty easy.
How about this?

@OliverJAsh Where do you expect to see the commit on the base branch or the head branch?
On the base branch/commit I think? (The existing "view file" points to the head branch/commit.)
This is possible:

Made by:
.dropdown-item link into .d-flexwidth: min-content; padding-left: 8px<div class="d-flex">
{previousLink}
<a {… previousLink attrs} style="padding-left: 8px !important;width: min-content;">
<GitHistoryIcon/>
</a>
</div>
This should be applied to regular commits as well.
If a file is deleted by the current commit, the "View file" already points to the old commit, so in that case perhaps we should add the icon inside the existing link; this would indicate that the link points to the old commit.