Skip to content

gh pr create when branch is on a fork  #2001

@maramSalamouny

Description

@maramSalamouny

Describe the feature or problem you’d like to solve

Doing gh pr create on a branch that's pushed to a fork doesn't detect the branch properly. Running the same command before pushing allows you to choose the remote and then correctly detects it when creating the PR.

Proposed solution

How will it benefit CLI and its users? A lot of people push branches to their forks not to the main repo!

Additional context

Without pushing first

`

gh pr create
Warning: 4 uncommitted changes
? Where should we push the 'tests' branch? maram/testRepo
Creating pull request for tests into master in ORG/testRepo
? Title tests
? Body
? What's next? Continue in browser
Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 12 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 730 bytes | 730.00 KiB/s, done.
Total 8 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To https:///maram/testRepo.git 2f524a467..9e1b2d88a HEAD -> tests
Branch 'tests' set up to track remote branch 'tests' from 'origin'.
Opening /ORG/testRepo/compare/master...maram:tests in your browser.`. <<< correctly detects my fork!!

With pushing first

`

gh pr create
Creating pull request for tests into master in ORG/testRepo
? Title tests
? Body
? What's next? Continue in browser
Opening /ORG/testRepo/compare/master...tests in your browser.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1Affects a large population and inhibits work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions