-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
My workflow with private repositories usually consists of:
- Create a new branch locally
- Modify code and create commits
- Create a PR in the private repository using
gh repo create --fill
The vast majority of times, the PR will be created in the base repository as defined by
Line 60 in 3443a75
| func (r *ResolvedRemotes) BaseRepo(io *iostreams.IOStreams) (ghrepo.Interface, error) { |
In other words, I'm pushing my local branch to the origin remote (the central, private repository) as part of the PR creation flow.
This is currently done through an interactive prompt, where the base repository is presented as the first option - I've created the muscle memory of just pressing <enter> right after running gh pr create every time.
Proposed solution
Implement a new flag that is functionally equivalent of selecting the first option presented in the interactive prompt of pr create when the local branch hasn't been pushed to a remote.
Users who primarily work on private repositories will usually only have a single push target, making the interactive prompt at each PR make less sense.
Alternatives
I can always run git push -u origin HEAD before calling gh pr create. Alternatively, an alias based approach was proposed in #1718 (comment) - gh alias set --shell cpr 'git push -u origin HEAD && gh pr create $*'.
Additional context
This has been previously discussed in:
- Allow setting a default push target for
pr create#1718 - allow
gh pr create --fillto be non-interactive #4879 - gh pr create: let specify the push remote #5717
Creating a new issue at the request of @andyfeller on #8146