Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Add "view file before commit/PR"  #1826

Open

Description

@OliverJAsh

Copied from refined-github/refined-github#3289

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.

Activity

  1. botatoes commented on Mar 2, 2021

    @botatoes

    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?

  2. OliverJAsh commented on Mar 3, 2021

    @OliverJAsh
    Author

    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

    • in unified diff, the selection would include code on both sides of the diff—I only want to select the code before it changed
    • in split view, the selection could include comments, and some parts of the code are collapsed so they are not easy to select

    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.

  3. botatoes commented on Mar 4, 2021

    @botatoes

    @OliverJAsh We just (super) recently shipped ability to copy only one side of the diff. Would that solve your problem?

  4. OliverJAsh commented on Mar 4, 2021

    @OliverJAsh
    Author

    @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:

    • the selection could include comments, and some parts of the code are collapsed so they are not easy to select

    Nothing can beat a raw version of the file.

  5. botatoes commented on Mar 4, 2021

    @botatoes

    Cool, thanks for clarifying :) I'll take it back to the team to discuss priority.

  6. OliverJAsh commented on Mar 19, 2021

    @OliverJAsh
    Author

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions