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
|
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:
Creating a new issue at the request of @andyfeller on #8146
My workflow with private repositories usually consists of:
gh repo create --fillThe vast majority of times, the PR will be created in the base repository as defined by
cli/context/context.go
Line 60 in 3443a75
In other words, I'm pushing my local branch to the
originremote (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 runninggh pr createevery time.Proposed solution
Implement a new flag that is functionally equivalent of selecting the first option presented in the interactive prompt of
pr createwhen 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 HEADbefore callinggh 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:
pr create#1718gh pr create --fillto be non-interactive #4879Creating a new issue at the request of @andyfeller on #8146