Skip to content

Add button to see the latest version of file/folder #1029

Closed

Description

@fregante

You ended up on a file in a random revision:

random revision

How do you get to master?

bunch of branches

Oh god.

What if... ?

goto HEAD (better icon needed, perhaps)

However finding HEAD is not always easy. We can literally use HEAD in the link, but that would not enable the edit/delete buttons. Example: https://github.com/sindresorhus/refined-github/blob/HEAD/source/content.js

Only folders seem to have this piece of information available on the page, so we might at least provide a link on these pages:

HEAD info on directories

Activity

  1. fregante commented on Jan 24, 2018

    @fregante
    MemberAuthor

    Possible solution:

    • link to user/repo?rgh-head-redirect=file.js
    • detect ?rgh-head-redirect=file.js as early as possible, find current branch, redirect to it

    The current branch is found in the <head> so we might get away with this before the first paint:

    <!-- Example code found in a repo root, where `source` is the default branch -->
    <link href="https://github.com/download-directory/download-directory.github.io/commits/source.atom" rel="alternate" title="Recent Commits to download-directory.github.io:source" type="application/atom+xml">

    It requires an extra HTTP request, but it's on demand, we don't have to make it unless it's explicitly requested.

  2. sindresorhus commented on Jan 25, 2018

    @sindresorhus
    Member

    It requires an extra HTTP request, but it's on demand, we don't have to make it unless it's explicitly requested.

    👍

  3. fregante commented on Jan 29, 2018

    @fregante
    MemberAuthor

    Related feature that would/could/should be merged:

    #395 (comment)

    Edit: this related feature is in #1049 🎉

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