Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PR search by multiple exact branch names #10816

@GMNGeoffrey

Description

@GMNGeoffrey

Describe the feature or problem you’d like to solve

I think the current search functionality of gh pr list has surprising behavior in that the --head foo argument or head:foo search atom will return any PR whose head branch starts with "foo". This appears to match the behavior of the web UI (https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-branch-name). While this arguably makes sense for an interactive web interface, I think this is surprising behavior for a command line interface and scripting tool. This is especially bad because there doesn't seem to be any way to search for an exact match

Proposed solution

Options:

  1. Make the search atom and flag for the head branch perform an exact match. To perform a prefix match, the syntax could be extended with standard * wildcards or full regex.
  2. Add a method to specify an exact search. Maybe quoting the branch name?

Of these, I prefer number 1. I think this is what the behavior should have been in the first place and is the expected behavior for this sort of tool. But I understand this would be a breaking change, so some alternative syntax would be another option. I think that's going to be a lot more awkward though.

Additional context

My use case is searching for merged PRs that match my local branches so that I can clean them up. Obviously an exact match is important here.

Metadata

Metadata

Assignees

Labels

enhancementa request to improve CLIgh-prrelating to the gh pr command

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions