Skip to content

Commit d115ca0

Browse files
authored
support multiple branches during init (#91)
* implicitly adopt branches in init * deprecate adopt flag * update docs * address review comments
1 parent 00a9589 commit d115ca0

8 files changed

Lines changed: 914 additions & 279 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ Initialize a new stack in the current repository.
7676
gh stack init [flags] [branches...]
7777
```
7878

79-
Creates an entry in `.git/gh-stack` to track stack state. In interactive mode (no arguments), prompts you to name branches and offers to use the current branch as the first layer. In interactive mode, you'll also be prompted to set an optional branch prefix (unless adopting existing branches). When a prefix is set, branch names you enter are automatically prefixed. When explicit branch names are given, creates any that don't already exist (branching from the trunk). The trunk defaults to the repository's default branch unless overridden with `--base`.
79+
Initializes a new stack locally. In interactive mode (no arguments), prompts for a branch name and offers to use the current branch as the first layer. If a branch name contains slashes (e.g., `feat/api`), prompts if you would like to use a prefix (e.g., `feat/`) for all branches in the stack.
80+
81+
When explicit branch names are given, existing branches are adopted automatically and any missing branches are created. The trunk defaults to the repository's default branch unless overridden with `--base`.
8082

8183
Use `--numbered` with `--prefix` to enable auto-incrementing numbered branch names (`prefix/01`, `prefix/02`, …). Without `--numbered`, you'll always be prompted to provide a meaningful branch name.
8284

@@ -85,7 +87,6 @@ Enables `git rerere` automatically so that conflict resolutions are remembered a
8587
| Flag | Description |
8688
|------|-------------|
8789
| `-b, --base <branch>` | Trunk branch for the stack (defaults to the repository's default branch) |
88-
| `-a, --adopt` | Adopt existing branches into a stack instead of creating new ones |
8990
| `-p, --prefix <string>` | Set a branch name prefix for the stack |
9091
| `-n, --numbered` | Use auto-incrementing numbered branch names (requires `--prefix`) |
9192

@@ -102,7 +103,7 @@ gh stack init feature-auth feature-api feature-ui
102103
gh stack init --base develop feature-auth
103104

104105
# Adopt existing branches into a stack
105-
gh stack init --adopt feature-auth feature-api
106+
gh stack init feature-auth feature-api
106107

107108
# Set a prefix — you'll be prompted for a branch name
108109
gh stack init -p feat

0 commit comments

Comments
 (0)