Stacked branches

Build a branch on another open branch, then land the stack from the bottom up.

Markdown

All pages

A stacked branch builds on another open branch instead of on main: main <- a <- b. Use it when b needs the unmerged work in a and you want to review and land them separately.

Create a stack#

oak switch -c part-two --stack          # stack on the current branch
oak switch -c part-three --parent part-two   # stack on a named open branch

With --stack the new branch starts at the current branch's head. --parent BRANCH stacks on that open branch instead (it needs a clean working tree, or --clean). --parent main is the ordinary, unstacked branch.

Working in a stack#

Landing a stack#

Land from the bottom up. oak merge on a branch that has a feature-branch parent refuses and names the bottom branch.

oak merge part-one --json    # lands on main and closes part-one
oak pull                     # in part-two: adopt main as the new parent
oak merge --dry-run --json   # predict the next one

When a branch lands or closes, the server moves its open children onto its own parent. The merge JSON lists them as restacked_branches, and the pull in a child reports restacked_from.

oak merge --into-parent folds a stacked branch into its parent locally instead of landing it on main.

See Branches for descriptions, and the CLI reference for the flags.

Something here wrong or missing? Run oak feedback -m "…" or email [email protected].