Asked before in #163, #202 and #213, closed on the grounds that the API cannot do it.
My use case: maintain a default branch fork that contains main plus a few commits of my own, as in https://github.com/krlmlr/duckdb/ . Currently solved with a custom action and pruning .github/workflows because GitHub Actions can't push workflows.
A "reverse rebase" might be feasible with calls Pull already makes:
PATCH /git/refs/heads/<base>-pull — temp branch at the upstream tip, force.
POST /pulls — head <base>, base <base>-pull.
PUT /pulls/{n}/merge with merge_method: "rebase" — replays the fork's own commits onto the upstream tip.
PATCH /git/refs/heads/<base> with force: true — move the branch to the result.
DELETE /git/refs/heads/<base>-pull.
Step 4 is what hardreset already does, so contents:write covers all of it, and the default branch needs no special handling. Conflicts surface as a 405 on step 3 and can take the existing conflictLabel path.
What do you think?
Asked before in #163, #202 and #213, closed on the grounds that the API cannot do it.
My use case: maintain a default branch
forkthat contains main plus a few commits of my own, as in https://github.com/krlmlr/duckdb/ . Currently solved with a custom action and pruning.github/workflowsbecause GitHub Actions can't push workflows.A "reverse rebase" might be feasible with calls Pull already makes:
PATCH /git/refs/heads/<base>-pull— temp branch at the upstream tip, force.POST /pulls— head<base>, base<base>-pull.PUT /pulls/{n}/mergewithmerge_method: "rebase"— replays the fork's own commits onto the upstream tip.PATCH /git/refs/heads/<base>withforce: true— move the branch to the result.DELETE /git/refs/heads/<base>-pull.Step 4 is what
hardresetalready does, socontents:writecovers all of it, and the default branch needs no special handling. Conflicts surface as a 405 on step 3 and can take the existingconflictLabelpath.What do you think?