Skip to content

pr create ignores base repository when selecting repository for pushing #800

@fiam

Description

@fiam

Describe the bug

When create a new PR via gh pr create from a branch that hasn't been pushed, gh ignores the base repository, considering only forks even if the submitter can push to the main repository.

This can create unexpected situations if the submitter doesn't have a personal fork. For example, if some other contributor has a personal fork and they gave you write access, gh pr create will push a new branch to their repo and then create a PR to the base.

I believe that selecting the base repository when the submitter can push to it is a better default, or at least a less surprising one.

Version: gh version 0.6.4-100-g82bd7b9 (2020-04-17) (compiled from master today)

Steps to reproduce the behavior

  1. Create a repository
  2. Ask someone else to fork it and give you write access to their fork
  3. Create a new local branch, commit some code but don't push it
  4. Run gh pr create
  5. Check the repository where the branch was created

Expected vs actual behavior

I'd expect gh pr create to create a branch in the main repository if the submitter has write access to it instead of choosing someone else's fork.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions