Skip to content

Only remote branches should be suggested when creating a PR against selected branch #1826

@moha-gh

Description

@moha-gh

Is your feature request related to a problem? Please describe.

When creating a PR against a selected branch (via O = "create pull request options"), the suggestion area is populated with all local branches. I'd say that only remote branches should be listed there - it doesn't really make sense to create a PR against a branch that doesn't exist on the remote (at least for Github).

To Reproduce

Steps to reproduce the behavior:

  1. Checkout local branch
  2. Press 'O'
  3. Select '... -> select branch' option

Describe the solution you'd like

Only remote branches are listed as suggestions.

Describe alternatives you've considered

n/a

Additional context

The suggestion function used in createPullRequestMenu() returns all local branches. Simply replacing it with GetRemoteBranchesSuggestionsFunc() doesn't work since the corresponding remote is then included in the branch name (i.e. <remote>/<branch>) - breaking the generated link.

I'd be happy to have a go at fixing this, but I'd need some pointers: I haven't fully grasped yet how the whole "create PR" feature deals with multiple remotes, for example - and whether that must be taken into account. Would a new suggestion function that lists remote branches without the <remote>/ prefix (and possibly for origin only) do the trick?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions