Search code examples
gitgithubgithub-apigithub-cli

search for a string in an unmerged PR in github


Is there a way to find the PR containing a code change from a list of unmerged PRs from all branches (even remote)?

For example if one of my unmerged PRs had a string stackoverflow, how can I search for it in github?


Solution

  • does this command search the content / changes in unmerged PRs

    A git log -GyourTerm would search in your current local branch.
    And unmerged PR branches (especially the one you did not created) are not in your local repositories.

    You need to fetch all PR, which can be done for GitHub for instance with gh pr list/gh pr checkout.

    Only then can you do a git log -GyourTerm --all --branches to search in all branches, including the PR ones.