You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Reacted by Sindre Sorhus, Laxman Damera, fregante, yakov116, Hugo Locurcio, Glenn 'devalias' Grant, Jeroen van Warmerdam and Arjun
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.
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.
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.
Reacted by Oliver Joseph Ash, Glenn 'devalias' Grant and Zadkiel AHARONIAN
This is still highly desirable! I see me View file, change branch to main, and update the org in the url too often!
The design you @fregante made at #3289 (comment) would work verry well for me!
Can you please re-open this issue?
Activity
[-]Add "view file before commit"[/-][+]Add "view file before commit/PR"[/+]yakov116 commentedon Jun 26, 2020
What about an
alt-clickto go to the parent commit?I think this would make sense as its own button. Also it would need to handle files created with this pr.
OliverJAsh commentedon Jun 26, 2020
@yakov116 That would work, although it's less discoverable.
fregante commentedon Jun 26, 2020
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.
OliverJAsh commentedon Jun 26, 2020
Isn't it just as simple as replacing the commit param in the URL with the following?
${COMMIT}^fregante commentedon Jun 26, 2020
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.
yakov116 commentedon Jun 28, 2020
How about this?
yakov116 commentedon Jun 29, 2020
@OliverJAsh Where do you expect to see the commit on the base branch or the head branch?
OliverJAsh commentedon Jun 29, 2020
On the base branch/commit I think? (The existing "view file" points to the head branch/commit.)
fregante commentedon Aug 8, 2020
This is possible:
Made by:
.dropdown-itemlink into.d-flexwidth: min-content; padding-left: 8pxThis 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.
Vyvy-vi commentedon Oct 29, 2022
fregante commentedon Oct 29, 2022
fregante commentedon Jun 12, 2024
Not one-click, but this is possible via the
View Historylink added bymore-file-linksaslafy-z commentedon Jan 10, 2025
This is still highly desirable! I see me View file, change branch to main, and update the org in the url too often!
The design you @fregante made at #3289 (comment) would work verry well for me!
Can you please re-open this issue?