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
{{ message }}
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
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 Hugo Locurcio, TheTechRobo and Waldir Pimenta
Hi @OliverJAsh I'm a PM at GitHub. Was wondering if you could explain your use case a bit more? Are you looking for more than what the split view is showing?
@botatoes I have another use case! This one comes up a lot.
I am running through a git blame through the GitHub UI. I am trying to trace a single line back to when it was originally added. The "View blame prior to this change" is very useful, until you reach a commit where the code was moved from one file to another. At this point, I have to view the commit where the code was moved so I can find where it was moved from. Once I've found where it was moved from, I can jump back into the blame view and continue my search.
The tricky part is this: the commit shows me where the code was moved from, but it's very difficult to perform a blame on the file before the code was moved.
If the UI allowed me to "view file before commit/PR" as I suggested in my OP, then this wouldn't be so difficult.
The issue occurs when a whole file has been moved or just a small subset of the file has been moved.
Activity
botatoes commentedon Mar 2, 2021
Hi @OliverJAsh I'm a PM at GitHub. Was wondering if you could explain your use case a bit more? Are you looking for more than what the split view is showing?
OliverJAsh commentedon Mar 3, 2021
Hey! I have a few different use cases, but the one that jumps to mind immediately is this:
When I'm viewing a PR, sometimes I want to copy a section of code before it changed. In the diff view this is difficult because
I have other use cases but I can't remember what they are right now. When I remember I'll try to drop a comment here.
botatoes commentedon Mar 4, 2021
@OliverJAsh We just (super) recently shipped ability to copy only one side of the diff. Would that solve your problem?
OliverJAsh commentedon Mar 4, 2021
@botatoes I just tested it but it only works in split view right? A lot of the time I'm reviewing in unified view.
Furthermore we still have these problems in split view:
Nothing can beat a raw version of the file.
botatoes commentedon Mar 4, 2021
Cool, thanks for clarifying :) I'll take it back to the team to discuss priority.
OliverJAsh commentedon Mar 19, 2021
@botatoes I have another use case! This one comes up a lot.
I am running through a git blame through the GitHub UI. I am trying to trace a single line back to when it was originally added. The "View blame prior to this change" is very useful, until you reach a commit where the code was moved from one file to another. At this point, I have to view the commit where the code was moved so I can find where it was moved from. Once I've found where it was moved from, I can jump back into the blame view and continue my search.
The tricky part is this: the commit shows me where the code was moved from, but it's very difficult to perform a blame on the file before the code was moved.
If the UI allowed me to "view file before commit/PR" as I suggested in my OP, then this wouldn't be so difficult.
The issue occurs when a whole file has been moved or just a small subset of the file has been moved.