Skip to content

Commit 7811dad

Browse files
devantlergithub-actions[bot]
authored andcommitted
chore(deps): update copilot skills
1 parent 93a437a commit 7811dad

1 file changed

Lines changed: 57 additions & 6 deletions

File tree

plugins/github/skills/gh-stack/SKILL.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ description: |
44
metadata:
55
author: github
66
github-path: skills/gh-stack
7-
github-ref: refs/tags/v0.0.1
7+
github-ref: refs/tags/v0.0.2
88
github-repo: https://github.com/github/gh-stack
9-
github-tree-sha: f900e01d90dd042162d0632dc31ee9541dd07841
10-
version: 0.0.1
9+
github-tree-sha: f11c787bea0bf060af1d8742464a22cd35aa1630
10+
version: 0.0.2
1111
name: gh-stack
1212
---
1313
# gh-stack
@@ -56,11 +56,12 @@ git config remote.pushDefault origin # if multiple remotes exist (skips remo
5656
2. **When a prefix is set, pass only the suffix to `add`.** `gh stack add auth` with prefix `feat``feat/auth`. Passing `feat/auth` creates `feat/feat/auth`.
5757
3. **Always use `--auto` with `gh stack submit`** to auto-generate PR titles. Without `--auto`, `submit` prompts for a title for each new PR.
5858
4. **Always use `--json` with `gh stack view`.** Without `--json`, the command launches an interactive TUI that cannot be operated by agents. There is no other appropriate flag — always pass `--json`.
59-
5. **Use `--remote <name>` when multiple remotes are configured**, or pre-configure `git config remote.pushDefault origin`. Without this, `push`, `submit`, `sync`, and `checkout` trigger an interactive remote picker.
59+
5. **Use `--remote <name>` when multiple remotes are configured**, or pre-configure `git config remote.pushDefault origin`. Without this, `push`, `submit`, `sync`, `link`, and `checkout` trigger an interactive remote picker.
6060
6. **Avoid branches shared across multiple stacks.** If a branch belongs to multiple stacks, commands exit with code 6. Check out a non-shared branch first.
6161
7. **Plan your stack layers by dependency order before writing code.** Foundational changes (models, APIs, shared utilities) go in lower branches; dependent changes (UI, consumers) go in higher branches. Think through the dependency chain before running `gh stack init`.
6262
8. **Use standard `git add` and `git commit` for staging and committing.** This gives you full control over which changes go into each branch. The `-Am` shortcut is available but should not be the default approach—stacked PRs are most effective when each branch contains a deliberate, logical set of changes.
6363
9. **Navigate down the stack when you need to change a lower layer.** If you're working on a frontend branch and realize you need API changes, don't hack around it at the current layer. Navigate to the appropriate branch (`gh stack down`, `gh stack checkout`, or `gh stack bottom`), make and commit the changes there, run `gh stack rebase --upstack`, then navigate back up to continue.
64+
10. **Use `gh stack link` for external tool workflows.** When branches are managed by an external tool (jj, Sapling, etc.), use `gh stack link branch-a branch-b`. `link` does not rely on local tracking state and is intended for API-driven PR and stack management. Always provide at least 2 branch names or PR numbers.
6465

6566
**Never do any of the following — each triggers an interactive prompt or TUI that will hang:**
6667
-`gh stack view` or `gh stack view --short` — always use `gh stack view --json`
@@ -539,6 +540,7 @@ gh stack submit --auto --draft
539540
- Pushes all active (non-merged) branches atomically (`--force-with-lease --atomic`)
540541
- Creates a new PR for each branch that doesn't have one (base set to the first non-merged ancestor branch)
541542
- After creating PRs, links them together as a **Stack** on GitHub (requires the repository to have stacks enabled)
543+
- If stacks are not available (exit code 9), the repository does not have stacked PRs enabled. In interactive mode, `submit` offers to create regular (unstacked) PRs instead. In non-interactive mode, it exits with code 9.
542544
- Syncs PR metadata for branches that already have PRs
543545

544546
**PR title auto-generation (`--auto`):**
@@ -554,6 +556,54 @@ gh stack submit --auto --draft
554556

555557
---
556558

559+
### Link branches as a stack (no local tracking) — `gh stack link`
560+
561+
Link PRs into a stack on GitHub without creating any local tracking state. This is the recommended approach if you are managing stacked branches with other tools (jj, Sapling, git-town) and want to simply create GitHub Stacked PRs via an API.
562+
563+
```
564+
gh stack link [flags] <branch-or-pr> <branch-or-pr> [...]
565+
```
566+
567+
```bash
568+
# Link branches into a stack (pushes, creates PRs, creates stack)
569+
gh stack link branch-a branch-b branch-c
570+
571+
# Use a different base branch and create PRs as drafts
572+
gh stack link --base develop --draft branch-a branch-b branch-c
573+
574+
# Link existing PRs by number
575+
gh stack link 10 20 30
576+
577+
# Add branches to an existing stack of PRs
578+
gh stack link 42 43 feature-auth feature-ui
579+
```
580+
581+
| Flag | Description |
582+
|------|---------|
583+
| `--base <branch>` | Base branch for the bottom of the stack (default: `main`) |
584+
| `--draft` | Create new PRs as drafts |
585+
| `--remote <name>` | Remote to push to (use if multiple remotes exist) |
586+
587+
**Behavior:**
588+
589+
- Arguments are provided in stack order (bottom to top)
590+
- Each argument can be a branch name or a PR number. Numeric arguments are tried as PR numbers first; if no PR with that number exists, the argument is treated as a branch name
591+
- Branch arguments are pushed to the remote automatically (non-force, atomic)
592+
- For branches without open PRs, new PRs are created with auto-generated titles and the correct base branch chaining (first branch uses `--base`, subsequent branches use the previous branch)
593+
- Existing PRs whose base branch doesn't match the expected chain are corrected automatically
594+
- If the PRs are not yet in a stack, a new stack is created. If some PRs are already in a stack, the stack is updated (additive only — existing PRs are never removed)
595+
- Does **not** create or modify any local state
596+
597+
**Output (stderr):**
598+
599+
- `Pushing N branches to <remote>...`
600+
- `Found PR #N for branch <name>` for branches with existing PRs
601+
- `Created PR #N for <branch> (base: <base>)` for newly created PRs
602+
- `Updated base branch for PR #N to <base>` when base branches are corrected
603+
- `Created stack with N PRs` or `Updated stack to N PRs`
604+
605+
---
606+
557607
### Sync the stack — `gh stack sync`
558608

559609
Fetch, rebase, push, and sync PR state in a single command. This is the recommended command for routine synchronization.
@@ -570,7 +620,7 @@ gh stack sync [flags]
570620

571621
1. **Fetch** latest changes from the remote
572622
2. **Fast-forward trunk** to match remote (skips if already up to date, warns if diverged)
573-
3. **Cascade rebase** all stack branches onto their updated parents (only if trunk moved). Handles squash-merged PRs automatically. If a conflict is detected, **all branches are restored** to their pre-rebase state and the command exits with code 3 — see [Handle rebase conflicts](#handle-rebase-conflicts-agent-workflow) for the resolution workflow
623+
3. **Cascade rebase** all stack branches onto their updated parents (only if trunk moved). Handles merged PRs automatically. If a conflict is detected, **all branches are restored** to their pre-rebase state and the command exits with code 3 — see [Handle rebase conflicts](#handle-rebase-conflicts-agent-workflow) for the resolution workflow
574624
4. **Push** all active branches atomically
575625
5. **Sync PR state** from GitHub and report the status of each PR
576626

@@ -625,7 +675,7 @@ gh stack rebase --abort
625675

626676
**Conflict handling:** See [Handle rebase conflicts](#handle-rebase-conflicts-agent-workflow) in the Workflows section for the full resolution workflow.
627677

628-
**Squash-merge detection:** If a branch's PR was squash-merged on GitHub, the rebase automatically handles this and correctly replays commits on top of the merge target.
678+
**Merged PR detection:** If a branch's PR was merged on GitHub, the rebase automatically handles this using `--onto` mode and correctly replays commits on top of the merge target.
629679

630680
**Rerere (conflict memory):** `git rerere` is enabled by `init` so previously resolved conflicts are auto-resolved in future rebases.
631681

@@ -783,6 +833,7 @@ gh stack unstack feature-auth
783833
| 6 | Disambiguation required | A branch belongs to multiple stacks. Run `gh stack checkout <specific-branch>` to switch to a non-shared branch first |
784834
| 7 | Rebase already in progress | Run `gh stack rebase --continue` (after resolving conflicts) or `gh stack rebase --abort` to start over |
785835
| 8 | Stack is locked | Another `gh stack` process is writing the stack file. Wait and retry — the lock times out after 5 seconds |
836+
| 9 | Stacked PRs unavailable | The repository does not have stacked PRs enabled. `submit` will offer to create regular (unstacked) PRs in interactive mode |
786837

787838
## Known limitations
788839

0 commit comments

Comments
 (0)