Repository navigation
feat(rebase): rebase one branch onto its base behind guards - #39
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, thenpush --force-with-leaseonto 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:
rebase.enabledA 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]Follow-ups are filed: #37 records which paths a conflict hit, #38 opens a session on one.
Closes #8
🤖 Generated with Claude Code