Skip to content

Find PR given commit hash #4160

Description

@eugeneotto

Describe the feature or problem you’d like to solve

When I'm exploring a repository, I like to review the PR associated with a given commit since it will often include helpful context that doesn't make it into the commit message.

To hop from a commit hash to the associated PR, I do the following:

  1. Discover an interesting commit via git log|show|blame
  2. Manually open a URL like this in my browser: https://github.com/organization/repository/commits/commit-hash
  3. Click the little PR link below the commit message

Proposed solution

gh pr find commit-hash

This would ideally print the PR's URL on a single line so it composes with other utilities, like open.

Activity

  1. mislav commented on Aug 23, 2021

    @mislav
    Contributor

    You can do this already via --search:

    gh pr list --state merged --search "<SHA>"
    

    We should add this to our documentation so it's more discoverable.

  2. eugeneotto commented on Aug 23, 2021

    @eugeneotto
    Author

    That worked! Thank you for this answer and also will_paginate :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions