stack-absorb

Distributes working-tree changes across the correct branches of a Graphite stack manually.

7.7k|1.1k|Updated Mar 19, 2025
One-click install
npx skills add https://github.com/maximhq/bifrost --skill stack-absorb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stack-absorb
Source: https://github.com/maximhq/bifrost/tree/main/.claude/skills/stack-absorb
Command: npx skills add https://github.com/maximhq/bifrost --skill stack-absorb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When working with Graphite (gt) stacked branches, gt absorb's blame-based algorithm often fails to assign changes to the right commit—new code has no prior line to blame onto, and hunks can land in semantically wrong commits. This Skill manually splits working-tree changes across the correct branches in the stack so each commit stays coherent and reviewable.

Core Features & Use Cases

  • Change-to-branch mapping: Uses git log -S, git branch --contains, and gt log long to identify which branch in the stack owns each concern in the diff.
  • Bottom-up application: Checks out each target branch in order, applies only that branch's slice of the change, verifies with build/typecheck, and commits via gt modify with automatic restacking.
  • Restack conflict resolution: Guides manual resolution of conflicts during restacking, including locating conflict markers, merging both sides, and continuing with gt continue.
  • Use Case: You made a bugfix and a new feature on the top branch of a five-branch Graphite stack, but the bugfix really belongs three branches down. This Skill splits the changes, places each hunk on its owning branch, and restacks cleanly.

Quick Start

Ask the assistant to split the current uncommitted changes into the correct branches of the Graphite stack using the stack-absorb workflow.

Frequently Asked Questions about stack-absorb

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split uncommitted changes across a Graphite stack?

Map each change to its owning branch using git log -S and gt log long, back up the files, restore a clean tree, then check out each target branch bottom-up and apply only its slice. Commit each with gt modify -a -m so descendants restack automatically.

When should I use manual splitting instead of gt absorb?

Use manual splitting when gt absorb --dry-run scatters hunks into semantically wrong commits or leaves new code as Not absorbed because there is no prior line to blame. If the dry run maps everything cleanly, plain gt absorb -a -f is sufficient.

Does gt absorb handle untracked new files?

No. Untracked files are never absorbed, even with gt absorb -a, which only stages unstaged tracked changes. Newly created files must be handled manually as part of the split and committed on the branch that owns them.

How do I resolve restack conflicts after gt modify?

Stay on the conflicted branch, locate every conflict region with grep for marker lines, merge both sides by hand, verify the file builds with no markers left, then run gt add on resolved files and gt continue. Repeat if further conflicts appear upstack.

Why avoid git stash when working with Graphite stacks?

This workflow forbids git stash because toolchain and lockfile churn makes stash pops conflict-prone in this repo. Instead, back up changed files to a scratchpad directory and restore tracked files with git restore --source=HEAD --staged --worktree.