8000 feat(rebase): rebase one branch onto its base behind guards by dominikwozniak · Pull Request #39 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat(rebase): rebase one branch onto its base behind guards - #39

Merged
dominikwozniak merged 2 commits into
mainfrom
feat/8-rebase-single-branch
Sep 17, 2026
Merged

dominikwozniak merged 2 commits into
mainfrom
feat/8-rebase-single-branch

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

dw-mc rebase <pr> brings one branch up to date with its base: rebase in a throwaway worktree cut from the tool's own clone, then push --force-with-lease onto the head the run read. My own checkout is never touched.

The guards are the point, because this push is the entire GitHub write surface in v1 (ADR 0002). They are read live rather than off the last sweep, since each is about the branch as it is now, and they fall in this order:

guard why it refuses
rebase.enabled off until a repository turns it on, so a force push is never a surprise
author a branch I did not open is not mine to push
fork the head branch is not in the repository that was read
not listed the open pull requests it reads a stack from did not carry it, so nothing can say whether it is in one
stack reported as its position, never driven
CI running a rebase now cancels the run I am waiting on
CI red mine to fix where it is

A conflict aborts the replay, pushes nothing and is written down against the head it hit, which puts the pull request in Needs me until the branch moves. A rebase that never started — no committer identity, a base that is not there — is reported as itself: only a rebase in progress can be aborted, so the abort is what tells the two apart.

flowchart LR
  A[dw-mc rebase] --> B{guards}
  B -->|refused| C[one sentence, nothing cut]
  B -->|passed| D[worktree at the PR head]
  D --> E{behind its base?}
  E -->|no| F[already on base]
  E -->|yes| G[git rebase]
  G -->|conflict| H[abort, record, Needs me]
  G -->|replayed| I[push --force-with-lease]
Loading

Follow-ups are filed: #37 records which paths a conflict hit, #38 opens a session on one.

Closes #8

🤖 Generated with Claude Code

dominikwozniak and others added 2 commits September 17, 2026 08:54
A branch that is behind its base is routine work that costs me a context
switch, so the tool does it: rebase in a throwaway worktree, push with a
lease on the head it read. The guards are the point. A force push is the
only write the tool makes to GitHub, so rebase stays off until a
repository turns it on, never runs while CI is in flight, and reports a
stacked pull request with its position rather than driving a stack it
does not understand. A conflict aborts the replay and is written down
against the head it happened at, which puts the pull request in Needs me
until the branch moves.

Closes #8

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The lease alone is not the boundary ADR 0002 draws. A pull request
somebody else opened, or one whose branch lives in a fork, is refused
before anything is cut, so the push is to a branch I author and nowhere
else. A pull request the open list did not carry is refused too: a stack
the tool cannot see is one it could drive.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit 84fde53 into main Sep 17, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the feat/8-rebase-single-branch branch September 17, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dw-mc rebase: single branch, with guards

1 participant

0