Skip to content

Add git stack untrack - #56

Merged
DomBlack merged 2 commits into
prfrom
untrack
Oct 16, 2026
Merged

DomBlack merged 2 commits into
prfrom
untrack

Conversation

@DomBlack

@DomBlack DomBlack commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Once a branch was in a stack there was no way to take it back out short of gh stack modify. It's the opposite of git stack init, so it should be just as cheap.

git stack untrack [branch] (and git untrack) stops tracking a branch and everything above it. A stack is a single line so it can't have a gap, and the branches themselves aren't touched at all: no commits, refs or checkouts change. With --only just that branch comes out, and the ones above close the gap by being restacked onto its parent (dropping its commits). A conflict there stops like any restack, and abort puts everything back, the untracked branch included. PRs stay open either way, and a stack GitHub already knows is regrouped at the next submit. Agents get stack_untrack.

While doing this I noticed pop had already added a way for abort to put back a branch that's no longer in any stack, which is exactly what untrack needs. So untrack uses that rather than a second copy of the same thing.

Once a branch was in a stack there was no way to take it back out short of gh stack modify, and dropping one from the middle meant rebasing everything above it by hand so its commits went away. That's the opposite of init, and it should be just as cheap.

Untrack takes a branch and everything above it out of its stack. gh stack keeps a stack as a single line so it can't have a gap, and the branches themselves are left exactly as they are (no ref moves, nothing is checked out); a stack left empty just goes away. With only, just that branch comes out and the ones above close the gap: they go through the reshape engine onto its parent, so the base fixing drops its commits, a conflict stops for continue or abort, and abort puts everything back.

The untracked branch isn't in any stack after that, so the abort couldn't find its entry in the graph like it does for a moved branch. The snapshot now remembers which branches were untracked (and their heads), and restoring puts those back too. A stack GitHub already knows is queued to be dissolved like any other reshape; no PR is closed, since the branches still exist and can be tracked again.
Dropping a branch from a stack was the last thing the README still sent you to gh stack modify for.

So git stack untrack (and git untrack) now does it: the current branch, or the one you name, comes out along with everything above it, or with --only just that branch, and the ones above are restacked onto its parent. It prints what was untracked, what was restacked and the git stack init that tracks them again. Agents get the same thing as stack_untrack, with branch and only.

The README, the MCP docs, the agent skill and the architecture notes cover it, and "What it doesn't do" no longer points at gh stack modify.
@DomBlack
DomBlack added this pull request to stack #59 October 16, 2026 13:30
@DomBlack DomBlack changed the title untrack Add git stack untrack Oct 16, 2026
@DomBlack DomBlack added the enhancement New feature or request label Oct 16, 2026
@DomBlack
DomBlack merged commit 9166042 into main Oct 16, 2026
5 checks passed
@DomBlack
DomBlack deleted the untrack branch October 16, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant