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.
rung adopt [branch]rung adopt [branch] --parent <parent>rung adopt --parent <parent>rung adopt --dry-runAliases
Section titled “Aliases”rung ad— shorthand forrung adopt
Options
Section titled “Options”| Option | Description |
|---|---|
[branch] | Branch to adopt. Defaults to the current branch. |
-p, --parent | Parent branch for the adopted branch. Shows interactive picker if omitted. |
--dry-run | Preview what would happen without making changes. |
Examples
Section titled “Examples”Adopt Current Branch
Section titled “Adopt Current Branch”git checkout my-featurerung adopt --parent mainAdopts the current branch (my-feature) with main as its parent.
Adopt Specific Branch
Section titled “Adopt Specific Branch”rung adopt feature/api --parent mainAdopts feature/api into the stack with main as its parent.
Interactive Parent Selection
Section titled “Interactive Parent Selection”rung adoptWhen no --parent is specified, rung shows an interactive picker with available parents (base branch and any branches already in the stack).
Preview with Dry Run
Section titled “Preview with Dry Run”rung adopt feature/api --parent main --dry-runShows what would happen without modifying the stack.
Workflow
Section titled “Workflow”Bringing Legacy Branches into the Stack
Section titled “Bringing Legacy Branches into the Stack”# You have existing branches created with plain gitgit branch# * main# feature/api
# Adopt them into the stack in ordergit checkout feature/authrung adopt --parent main
git checkout feature/apirung adopt --parent feature/auth
# Check the stackrung status Stack ────────────────────────────────────────────────── ● feature/auth ← main ● ▶ feature/api ← feature/auth ──────────────────────────────────────────────────
● synced ● needs sync ● conflictAdopting a Branch Chain
Section titled “Adopting a Branch Chain”When adopting multiple related branches, adopt them bottom-up (closest to main first):
# Wrong order - will failrung adopt feature/child --parent feature/parent# Error: Parent 'feature/parent' is not in the stack
# Correct orderrung adopt feature/parent --parent mainrung adopt feature/child --parent feature/parentValidation
Section titled “Validation”Rung validates that:
- Branch exists — The branch must exist in Git
- Not already in stack — Can’t adopt a branch that’s already managed
- Valid parent — Parent must be either the base branch or already in the stack
- The branch must already exist in Git (use
rung createfor new branches) - Adopting doesn’t modify the branch’s commits or history
- After adopting, use
rung syncto rebase if the parent has moved - The base branch (usually
main) is always a valid parent option