-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
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:
- 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. - 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.