Skip to content

adopt

v0.6.0+

Adopt an existing Git branch into the rung stack by establishing its parent relationship. Use this when you have branches created outside of rung that you want to manage as part of your stack.

Terminal window
rung adopt [branch]
rung adopt [branch] --parent <parent>
rung adopt --parent <parent>
rung adopt --dry-run
  • rung ad — shorthand for rung adopt
OptionDescription
[branch]Branch to adopt. Defaults to the current branch.
-p, --parentParent branch for the adopted branch. Shows interactive picker if omitted.
--dry-runPreview what would happen without making changes.
Terminal window
git checkout my-feature
rung adopt --parent main

Adopts the current branch (my-feature) with main as its parent.

Terminal window
rung adopt feature/api --parent main

Adopts feature/api into the stack with main as its parent.

Terminal window
rung adopt

When no --parent is specified, rung shows an interactive picker with available parents (base branch and any branches already in the stack).

Terminal window
rung adopt feature/api --parent main --dry-run

Shows what would happen without modifying the stack.

feature/auth
# You have existing branches created with plain git
git branch
# * main
# feature/api
# Adopt them into the stack in order
git checkout feature/auth
rung adopt --parent main
git checkout feature/api
rung adopt --parent feature/auth
# Check the stack
rung status
Stack
──────────────────────────────────────────────────
● feature/auth ← main
● ▶ feature/api ← feature/auth
──────────────────────────────────────────────────
● synced ● needs sync ● conflict

When adopting multiple related branches, adopt them bottom-up (closest to main first):

Terminal window
# Wrong order - will fail
rung adopt feature/child --parent feature/parent
# Error: Parent 'feature/parent' is not in the stack
# Correct order
rung adopt feature/parent --parent main
rung adopt feature/child --parent feature/parent

Rung validates that:

  1. Branch exists — The branch must exist in Git
  2. Not already in stack — Can’t adopt a branch that’s already managed
  3. Valid parent — Parent must be either the base branch or already in the stack
  • The branch must already exist in Git (use rung create for new branches)
  • Adopting doesn’t modify the branch’s commits or history
  • After adopting, use rung sync to rebase if the parent has moved
  • The base branch (usually main) is always a valid parent option
  • create — Create a new branch in the stack
  • status — View the stack tree
  • sync — Sync branches after adoption