fix(stack): release checked-out landed branches#30
Closed
aryasaatvik wants to merge 1 commit into
Closed
Conversation
Detach clean sibling worktrees that own a just-landed branch before deleting the local branch during stack merge cleanup. Dirty target owners now fail before hosted merge, matching descendant repair preflight behavior.
Contributor
Author
|
Closing this in favor of the consolidated PR #31. |
kitlangton
pushed a commit
that referenced
this pull request
Jun 30, 2026
When `stack merge --apply` or `stack merge --auto` lands a branch that is checked out in another worktree, Git refuses to delete it, leaving the stack half-landed locally. Add `Git.release(branch)` to detach a clean sibling worktree at HEAD before deleting the landed branch, and fail before hosted mutation when that worktree is dirty.
Owner
|
Merged directly to main (the SKILL.md conflict from the skill simplification prevented a clean squash-merge through GitHub). The commit preserves authorship. Thanks @aryasaatvik! |
kitlangton
added a commit
that referenced
this pull request
Jun 30, 2026
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.
Summary
stack merge --applyandstack merge --autocan complete the hosted merge, then fail during local cleanup when the landed branch is checked out in another worktree. Git refuses to delete a branch that is checked out elsewhere, which leaves the stack half-landed locally even though the PR has merged.This PR adds an explicit release step for clean sibling worktrees that own the landed branch, and fails before hosted mutation when that target worktree is dirty.
Changes
Git.release(branch)to detach a clean sibling worktree atHEADwhen it owns the landed branch.release(target)beforedrop(target)during post-merge local cleanup.--applyand--autocleanup, and dirty target refusal.Tests
bun run testbun run typecheckbun run format:checkbun run lintbun run buildbun run package:smoke