Skip to content

Playbooks for g

Story-style workflows—solo, team, and on-call. Jump into the full Use cases page anytime.

commands::stack

Stacked PR workflow management.

auto-generated This page is built from //! comments in the Rust source. Edit the source and run npm run docs:extract to update it.

Stacked PR workflow management.

Overview

This folder implements the “Stacked Pull Requests” workflow. It tracks ordered lists of branches (called stacks) in the stacks and stack_branches tables of ~/.config/g/g.db.

Folder layout

stack/
  mod.rs        ← this file: dispatch() + module wiring
  shared.rs     ← cross-subcommand helpers (current_stack, restack, GitHub token, …)
  new.rs        ← `g stack new <name>`
  add.rs        ← `g stack add <branch>`
  list.rs       ← `g stack list` (and the `view` alias)
  details.rs    ← `g stack details` — per-branch commits + live PRs
  switch.rs     ← `g stack switch <name>`
  absorb.rs     ← `g stack absorb` — merge current into the one below
  fold.rs       ← `g stack fold` — collapse current into parent
  squash.rs     ← `g stack squash` — one-commit-per-branch
  sync.rs       ← `g stack sync` — rebase the whole chain
  push.rs       ← `g stack push`
  pr.rs         ← `g stack pr` — create / update GitHub PRs
  remove.rs     ← `g stack remove <branch>`
  delete.rs     ← `g stack delete <name>`
  reorder.rs    ← `g stack up` / `g stack down`

Each subcommand file exposes a pub(super) fn run(…) so this module is the only public face: command code outside this folder calls [dispatch] and never touches a subcommand file directly.

Source: src/commands/stack/mod.rs