feat: record stacked base locally so gw status suggests -B - #45
Merged
Conversation
gw new --stack now records the parent in branch.<child>.gwBase. Before a PR exists, gw status reads it and turns the create-PR next-action into `gh pr create -B <parent>`, so the stacked base can't be forgotten -- the one manual step that survived the structural redesign. Once a PR exists, GitHub's base stays authoritative; gwBase only fills the pre-PR gap. - git: branch_base / set_branch_base / unset_branch_base helpers (local config) - new: record the base after a successful --stack - next_action: CreatePr carries an optional stacked base - status: read + filter the recorded base, show it pre-PR, pass it to detect - sync: unset on restack (branch is no longer stacked); branch delete clears the rest, so cleanup needs no change Stale gwBase (parent merged before the child PR is opened) is left for the parent/child guard work; gh pr create errors loudly on a missing base. Co-Authored-By: Claude Opus 4.8 (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.
What
Phase 2 of stacked-PR support.
gw new --stacknow records the parent inbranch.<child>.gwBase(local git config). Before a PR exists,gw statusreads it and turns the create-PR next-action intogh pr create -B <parent>, eliminating the one manual step that survived #43's structural redesign — forgetting-B.Once a PR exists, GitHub's
base_branchstays authoritative (unchanged);gwBaseonly fills the pre-PR gap.Changes
branch_base/set_branch_base/unset_branch_basehelpers (local config, no network).--stack.CreatePr { base: Option<String> }— emits-B <parent>when stacked.Base: <parent> (stacked, PR not created yet)pre-PR, pass it todetect.unset_branch_baseafter restacking onto the default branch (no longer stacked). Branch deletion drops the whole[branch]section, socleanupneeds no change (verified).Rationale for the stale-base decision
A
gwBasecan go stale only in a narrow window (parent merged + branch deleted between--stackand the child's PR). Phase 2 deliberately does not verify the parent's remote existence:gh pr create -B Xfails loudly on a missing base (gw never runs it itself — it's a suggested command).ls-remoteround-trip to everygw statuson a stacked branch.-Bhere would be half-right and mask it.Test
next_action: unit test forCreatePr { base: Some(..) }.tests/new_test.rs:--stackrecordsgwBase; plain new records none;gw statussurfaces the stacked base and the-B feature/parenthint end-to-end (no manual checking needed).mise run verifypasses.🤖 Generated with Claude Code