Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default base branch for new PRs #8979

Open
heaths opened this issue Apr 19, 2024 · 0 comments
Open

Set default base branch for new PRs #8979

heaths opened this issue Apr 19, 2024 · 0 comments
Labels
enhancement a request to improve CLI needs-triage needs to be reviewed

Comments

@heaths
Copy link
Contributor

heaths commented Apr 19, 2024

Describe the feature or problem you’d like to solve

When working against a feature branch with branch protection (or rulesets) set, it would be very helpful to be able to set the default branch for subsequent gh pr create commands.

Proposed solution

I can think of a couple options numbered according to my preference, as well as for ease of reference in comments.

  1. Figure out the closest branch (at least local, if not remote) and use that as the base. To avoid breaking current behavior, a new switch could be added e.g., --auto-base. That is, what is a branch that contains a more recent commit that is not only in the current branch.
  2. Set a marker in .git/config (with worktree support, of course) much like gh repo set-default does. The downside is that you have to remember to unset or move this.

Additional context

Major feature work may happen in a feature branch while the repo stays on main or something, so most contributors' PRs should be against main and only those virtual team members working on the feature branch should use it as a base for PRs.

gh is in a unique position to do something here because creating a pull request (outside of email/mailbox) is outside the scope of Git, and there's probably no great way for the web site to do this (well, maybe isolated storage to roam or even a local cookie).

@heaths heaths added the enhancement a request to improve CLI label Apr 19, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request to improve CLI needs-triage needs to be reviewed
Projects
None yet
Development

No branches or pull requests

2 participants