|
1 | 1 | # stack |
2 | 2 |
|
3 | | -`stack` is a CLI for stacked pull requests on GitHub. |
| 3 | +`stack` is a CLI for stacked pull requests and landing orchestration on GitHub. |
4 | 4 |
|
5 | | -It helps you split one large change into a chain of smaller dependent PRs, keep |
6 | | -their branch relationships straight, update PR bases when parents move, and hand |
7 | | -the ready bottom PR to GitHub merge queue without turning your repo into |
8 | | -something only one tool understands. |
| 5 | +It helps you do two related jobs without inventing a hosted control plane: |
| 6 | + |
| 7 | +- keep an explicit parent graph for ordinary stacked PRs |
| 8 | +- turn a verified set of existing PRs into one explicit landing branch and landing PR |
9 | 9 |
|
10 | 10 |  |
11 | 11 |
|
12 | 12 |  |
13 | 13 |
|
14 | 14 | ## What stacked PRs are |
15 | 15 |
|
16 | | -A stacked PR flow takes one bigger feature and breaks it into a sequence: |
| 16 | +A stacked PR flow splits one larger change into a chain: |
17 | 17 |
|
18 | 18 | - branch A targets `main` |
19 | 19 | - branch B builds on A and its PR targets A |
20 | 20 | - branch C builds on B and its PR targets B |
21 | 21 |
|
22 | | -That makes review smaller and landing order clearer, but it also creates work: |
23 | | -when A changes or merges, B and C need to move with it. |
| 22 | +That gives reviewers smaller PRs. It also makes landing order explicit. The |
| 23 | +cost is that branch heads and PR bases need to move together when something |
| 24 | +lower in the stack changes or merges. |
24 | 25 |
|
25 | 26 | ## What `stack` does |
26 | 27 |
|
27 | 28 | `stack` keeps that workflow explicit and repairable: |
28 | 29 |
|
29 | | -- you create or track a branch inside a stack |
30 | | -- you restack branches when parents move |
31 | | -- you submit one normal GitHub PR per branch |
32 | | -- you sync local stack state after merges or GitHub-side changes |
33 | | -- you queue the bottom PR when it is ready |
| 30 | +- create or track branches inside a stack |
| 31 | +- restack branches when parents move |
| 32 | +- submit one normal GitHub PR per tracked branch |
| 33 | +- compose one landing branch from a selected verified subset |
| 34 | +- attach verification and ticket metadata to the landing branch |
| 35 | +- mark original PRs as superseded and close them out after landing |
| 36 | +- hand the real merge target to GitHub auto-merge or merge queue |
34 | 37 |
|
35 | 38 | The branches stay ordinary Git branches. The PRs stay ordinary GitHub PRs. If |
36 | | -you stop using `stack`, the repository still looks like a normal repository. |
37 | | - |
38 | | -## Merge queue |
39 | | - |
40 | | -`stack queue` is for the bottom branch in a healthy stack. It verifies the PR |
41 | | -base, head, and remote state, then hands that PR to GitHub auto-merge or merge |
42 | | -queue. After the merge lands, `stack sync` helps the rest of the stack catch up |
43 | | -without guessing through ambiguous cases. |
44 | | - |
45 | | -That handoff uses GitHub's own auto-merge path via `gh pr merge --auto`, so the |
46 | | -repository must have auto-merge enabled. If the repo also uses merge queue, |
47 | | -GitHub decides whether the PR goes straight to auto-merge or enters the queue. |
48 | | - |
49 | | -## How it differs from Graphite and similar tools |
50 | | - |
51 | | -`stack` is closest in spirit to tools that keep explicit local stack metadata, |
52 | | -but it is deliberately simple: |
53 | | - |
54 | | -- it works with ordinary branches and ordinary GitHub PRs |
55 | | -- it keeps stack intent locally, not in a hosted control plane |
56 | | -- it favors previews, confirmations, and repair loops over hidden automation |
57 | | -- it stays legible even if someone on the team never installs the tool |
58 | | - |
59 | | -That makes it a good fit for teams that want stacked PRs on GitHub without |
60 | | -adopting a more opinionated end-to-end workflow. |
| 39 | +you stop using `stack`, the repo still looks like a normal repo. |
61 | 40 |
|
62 | | -## Install |
| 41 | +## Two landing paths |
63 | 42 |
|
64 | | -```bash |
65 | | -brew tap hack-dance/homebrew-tap |
66 | | -brew install hack-dance/tap/stack |
67 | | -``` |
| 43 | +Use the basic stacked-PR flow when each branch should land in order as its own |
| 44 | +PR. |
68 | 45 |
|
69 | | -More install and source-build options live in [docs/install.md](docs/install.md). |
| 46 | +Use the landing workflow when the graph is useful for organization and repair, |
| 47 | +but the real merge target should be one combined landing PR. That is the right |
| 48 | +path when you already have a pile of open PRs, want to verify a strict subset, |
| 49 | +and need the originals to become traceability-only. |
70 | 50 |
|
71 | 51 | ## Quick start |
72 | 52 |
|
| 53 | +Clean stack: |
| 54 | + |
73 | 55 | ```bash |
74 | 56 | stack init --trunk main --remote origin |
75 | 57 | stack create feature/base |
76 | 58 | stack create feature/child |
77 | | -stack status |
78 | 59 | stack submit --all |
79 | 60 | stack queue feature/base |
80 | 61 | ``` |
81 | 62 |
|
82 | | -Before using `stack queue`, make sure the GitHub repository has auto-merge |
83 | | -enabled. |
| 63 | +Landing workflow from an existing PR pile: |
| 64 | + |
| 65 | +```bash |
| 66 | +stack init --trunk main --remote origin |
| 67 | +stack adopt pr 353 --parent main |
| 68 | +stack adopt pr 354 --parent pr/353 |
| 69 | +stack compose discovery-core --from pr/353 --to pr/354 --ticket LNHACK-66 --open-pr |
| 70 | +stack verify add stack/discovery-core --type sim --run-id run-123 --passed |
| 71 | +stack supersede --landing stack/discovery-core --prs 353,354 --close-after-merge |
| 72 | +stack queue stack/discovery-core |
| 73 | +stack closeout stack/discovery-core --apply |
| 74 | +``` |
84 | 75 |
|
85 | 76 | For the full daily workflow, start with [docs/usage.md](docs/usage.md). |
86 | 77 |
|
| 78 | +For the real operator workflow around one combined landing PR, start with |
| 79 | +[docs/landing-workflow.md](docs/landing-workflow.md). |
| 80 | + |
| 81 | +## Merge queue |
| 82 | + |
| 83 | +`stack` does not reimplement merge queue. It only hands off the chosen PR |
| 84 | +through `gh pr merge --auto`. |
| 85 | + |
| 86 | +Sometimes that PR is the bottom tracked branch. Sometimes it is the landing PR. |
| 87 | +GitHub decides whether the handoff becomes auto-merge or queue entry. |
| 88 | + |
| 89 | +The repo must have auto-merge enabled before `stack queue` can work. |
| 90 | + |
87 | 91 | ## Starting from existing PRs |
88 | 92 |
|
89 | 93 | You do not need to start with a clean stack on day one. |
90 | 94 |
|
91 | | -If you already have a pile of open PRs, `stack` can still help you turn them |
92 | | -into an explicit stack so you can test them as a composed set, land them in a |
93 | | -clean order, and handle conflicts with less guesswork. |
| 95 | +If you already have a larger PR pile, `stack` can help you: |
| 96 | + |
| 97 | +- adopt the existing heads into an explicit graph |
| 98 | +- repair parent order and base drift |
| 99 | +- compose one strict landing branch from a verified subset |
| 100 | +- keep the original PRs for traceability instead of queueing them directly |
| 101 | + |
| 102 | +Use [docs/adopting-existing-prs.md](docs/adopting-existing-prs.md) to make the |
| 103 | +graph explicit, then [docs/landing-workflow.md](docs/landing-workflow.md) to |
| 104 | +turn that graph into one landing PR. |
| 105 | + |
| 106 | +## How it differs from Graphite and similar tools |
| 107 | + |
| 108 | +`stack` stays deliberately simple: |
| 109 | + |
| 110 | +- ordinary branches |
| 111 | +- ordinary GitHub PRs |
| 112 | +- explicit local metadata |
| 113 | +- previews and repair loops instead of hidden automation |
94 | 114 |
|
95 | | -The practical path is: |
| 115 | +That makes it a good fit for teams that want stacked PRs and landing batches on |
| 116 | +GitHub without committing the repo to a hosted workflow layer. |
| 117 | + |
| 118 | +## Install |
96 | 119 |
|
97 | | -1. check out the repo locally and make sure you have local branches for the PR heads you care about |
98 | | -2. decide the intended parent chain or grouping |
99 | | -3. run `stack track <branch> --parent <parent>` for each branch |
100 | | -4. run `stack status` and `stack sync` to see what does not match yet |
101 | | -5. use `stack move`, `stack restack`, and `stack submit` to bring the stack into shape |
| 120 | +```bash |
| 121 | +brew tap hack-dance/homebrew-tap |
| 122 | +brew install hack-dance/tap/stack |
| 123 | +``` |
102 | 124 |
|
103 | | -That adoption flow is documented in [docs/adopting-existing-prs.md](docs/adopting-existing-prs.md). |
| 125 | +More install and source-build options live in [docs/install.md](docs/install.md). |
104 | 126 |
|
105 | 127 | ## Documentation |
106 | 128 |
|
107 | 129 | - [docs/README.md](docs/README.md) for the full docs index |
108 | | -- [docs/adopting-existing-prs.md](docs/adopting-existing-prs.md) for grouping and ordering an existing PR set |
| 130 | +- [docs/usage.md](docs/usage.md) for the standard stacked-PR loop |
| 131 | +- [docs/landing-workflow.md](docs/landing-workflow.md) for the landing-orchestration path |
| 132 | +- [docs/adopting-existing-prs.md](docs/adopting-existing-prs.md) for making an existing PR graph explicit |
109 | 133 | - [docs/how-it-works.md](docs/how-it-works.md) for the model and workflow |
110 | | -- [docs/usage.md](docs/usage.md) for everyday commands and repair loops |
111 | | -- [docs/troubleshooting.md](docs/troubleshooting.md) for common failure modes |
| 134 | +- [docs/troubleshooting.md](docs/troubleshooting.md) for failure modes and repair paths |
112 | 135 | - [docs/cli/stack.md](docs/cli/stack.md) for generated command reference |
113 | 136 |
|
114 | 137 | Contributor docs live in [docs/testing.md](docs/testing.md) and |
|
0 commit comments