Skip to content

feat: add st track, create, log, up, down and stack-wide submit#40

Merged
siner308 merged 5 commits intomainfrom
test/stack-c
Mar 19, 2026
Merged

feat: add st track, create, log, up, down and stack-wide submit#40
siner308 merged 5 commits intomainfrom
test/stack-c

Conversation

@siner308
Copy link
Copy Markdown
Owner

@siner308 siner308 commented Mar 18, 2026

Summary

  • Add st track / st untrack for explicit branch tracking via git config (branch.<name>.staqd-parent)
  • Add st create for branch creation with auto-tracking
  • Add st log for tracked stack tree visualization
  • Add st up / st down for stack navigation
  • Update st submit to create PRs for the entire tracked chain (root → leaf), not just the current branch
  • Add track helpers to cli/git.mjs (getTrackedParent, setTrackedParent, unsetTrackedParent, listTrackedBranches)

Motivation

Previously st submit only created a PR for the current branch. With stacked workflows (main → a → b → c), users had to run st submit on each branch individually. Now, st track registers the parent relationship in git config, and st submit walks the chain to create all missing PRs at once — similar to Graphite's gt track + gt submit.

New Commands

Command Description
st track Register current branch (auto-detect or --parent)
st track --list Show all tracked branches
st untrack Remove current branch from tracking
st create <name> Create branch + auto-track
st log Tree visualization of tracked stack
st up Checkout child branch
st down Checkout parent branch

Design Decisions

  • Git config storage (branch.<name>.staqd-parent): Same approach as Graphite. No external DB, survives branch operations, portable.
  • Parent validation: Parent must be default branch or a tracked branch whose chain reaches default branch. Prevents orphan PRs.
  • Backward compatible: st submit without any tracked branches falls back to the existing detectBase behavior.

Test plan

  • st track --parent=main on a branch → verify git config set
  • st track --list shows tracked branches
  • st untrack removes tracking
  • st log shows tree with current branch highlighted
  • st create <name> creates branch and auto-tracks
  • st up / st down navigate the stack
  • st submit --dry-run on a tracked stack shows PRs to create for entire chain
  • st submit creates PRs for all unsubmitted branches in chain
  • Untracked branch + st submit falls back to existing behavior

Generated with Claude Code

  Add explicit branch tracking via git config (staqd-parent), replacing
  implicit merge-base detection for stack PR creation. st submit now
  walks the tracked chain root→leaf to create PRs for the entire stack.

  New commands: track, untrack, create, log, up, down.

  Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
  mailto:noreply@anthropic.com
  • Replace direct execFileSync in create.mjs with git.checkoutNew helper
  • Use regex capture group for branch name extraction in listTrackedBranches
  to handle branch names containing dots correctly

  Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
  mailto:noreply@anthropic.com
@siner308 siner308 merged commit 4ed975c into main Mar 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant