Fine grained default branch: default PR/clone/template branch #192192
-
🏷️ Discussion TypeQuestion BodyHi there, I tried to search existing discussion and explored settings but haven't found any match so far. Our use case is we have a template repo using gitflow model ( I could see from settings:
But I didn't find any place to "specify a different branch"? Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Re: Fine grained default branchHi @DanielYang59, GitHub's default branch controls both the PR base and the clone/template branch — there is no way to set them independently today. Best workaround for your gitflow setupSet
To handle the template issue, add a note in your Alternatively, keep This is a known GitHub limitation — no native solution exists yet. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, GitHub ties the default branch to everything: PR base, clone target, template source. No way to split those today. For a gitflow setup with templates, the least painful approach I've found is keeping You can't auto-change the PR base branch, but you can add a clear note at the top of your PR template: <!--
Base branch should be `develop`, not `main`.
Please change the base before submitting.
-->Another option: use a GitHub Actions workflow that auto-comments on PRs targeting name: PR base check
on:
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Heads up: PRs should target \`develop\`, not \`main\`. Please update the base branch.'
})Not perfect, but it catches mistakes early. The "specify a different branch" line in the docs is misleading, it just means you can choose which branch is the default, not that you can set different defaults per use case. If this is a dealbreaker for your workflow, it might be worth opening a feature request in the |
Beta Was this translation helpful? Give feedback.
-
|
Hi @ideepakchauhan7 @Gecko51 thanks both for the comments and the proposed workaround. Yes we currently used the "default
Thanks a lot. I wasn't aware of that (thought here is the place for feature request), I would open one there, thanks for the input! |
Beta Was this translation helpful? Give feedback.
-
|
reopened in https://github.com/orgs/community/discussions/192229 |
Beta Was this translation helpful? Give feedback.

Yeah, GitHub ties the default branch to everything: PR base, clone target, template source. No way to split those today.
For a gitflow setup with templates, the least painful approach I've found is keeping
mainas default (since that's what template users expect) and then using a branch protection rule + a repo-levelPULL_REQUEST_TEMPLATE.mdto steer PRs towarddevelop.You can't auto-change the PR base branch, but you can add a clear note at the top of your PR template:
Another option: use a GitHub Actions workflow that auto-comments on PRs targeting
mainwith a reminder to retarget tode…