重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
graphite-stacks by outfitter-dev/agents
npx skills add https://github.com/outfitter-dev/agents --skill graphite-stacks使用 Graphite CLI 进行基于主干开发并管理堆叠式 PR。
<when_to_use>
gt 命令的使用场景</when_to_use>
仅使用 gt 命令。 混用 git 和 gt 会导致同步问题和分支栈分歧。唯一例外:使用 git add 暂存文件(或使用 -a 标志)。
| 任务 | 这样做 |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 而非那样做 |
|---|
| 创建分支 | gt create 'name' -am "msg" | git checkout -b name |
| 提交更改 | gt modify -acm "msg" | git commit -m "msg" |
| 推送到远程 | gt submit | git push |
| 变基栈 | gt restack | git rebase |
| 查看栈状态 | gt status 或 gt ls | git log --graph |
| 切换分支 | gt checkout | git checkout |
| 修改提交 | gt modify -a | git commit --amend |
| 处理多 PR 反馈 | gt top && gt absorb -a | 手动挑选提交 |
创建栈 → 实现功能 → 提交 PR → 处理反馈 → 合并
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
gt create gt modify -acm gt submit gt absorb gt sync
# 创建新分支并暂存更改
gt create 'feature/step-1' -am "feat: first step"
# 继续堆叠
gt create 'feature/step-2' -am "feat: second step"
gt create 'feature/step-3' -am "feat: third step"
# 在当前分支与其子分支之间插入分支
gt create 'feature/step-1.5' --insert -am "feat: inserted step"
| 命令 | 动作 |
|---|---|
gt up | 向上移动(朝向子分支) |
gt down | 向下移动(朝向父分支) |
gt top | 跳转到栈顶 |
gt bottom | 跳转到栈底 |
gt checkout | 交互式分支选择器 |
# 修改当前分支(暂存所有更改)
gt modify -a
# 在同一分支内创建新提交
gt modify -acm "fix: address review feedback"
# 提交到栈中的另一个分支
git add path/to/file.ts
gt modify --into target-branch -m "feat: add file"
务必:
gt create 创建新分支gt modify 进行提交gt submit 推送gt restackgt status切勿:
git commit/push/rebase 与 gt 工作流混用git rebase -i(会破坏 Graphite 元数据)单个 PR:导航到目标分支,直接修改
gt checkout target-branch
gt modify -acm "fix: address review comment"
gt submit
栈中的多个 PR:从栈顶开始使用 absorb 命令
gt top
git add .
gt absorb -a
gt submit --stack
Graphite 会根据文件历史将更改路由到正确的分支。
# 将分支移动到不同的父分支下
gt move --onto new-parent
# 移动特定分支
gt move --source branch-name --onto target
# 重组后执行
gt restack
# 当前分支及其下游分支
gt submit
# 整个栈
gt submit --stack
# 非交互式(用于自动化)
gt submit --no-interactive
# 包含父子关系的 JSON(脚本首选)
gt status
# 可视化树状图
gt ls
# 最近历史记录
gt log
# 拉取主干,变基栈,清理已合并分支
gt sync
# 将分支变基到更新后的父分支上
gt restack
# 撤销上一次 gt 操作
gt undo
栈损坏的症状:
gt status 显示意外的结构请参阅 recovery.md 获取逐步恢复流程。
每周安装数
58
代码仓库
GitHub 星标数
25
首次出现
2026年1月26日
安全审计
安装于
opencode50
codex48
github-copilot48
gemini-cli47
claude-code46
cursor44
Trunk-based development with stacked PRs using Graphite CLI.
<when_to_use>
gt command usage</when_to_use>
Usegt commands exclusively. Mixing git and gt causes sync issues and divergent stacks. The only exception: git add for staging (or use -a flags).
| Task | This | Not That |
|---|---|---|
| Create branch | gt create 'name' -am "msg" | git checkout -b name |
| Commit changes | gt modify -acm "msg" | git commit -m "msg" |
| Push to remote | gt submit | git push |
| Rebase stack | gt restack | git rebase |
Create stack → Implement features → Submit PRs → Address feedback → Merge
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
gt create gt modify -acm gt submit gt absorb gt sync
# New branch with staged changes
gt create 'feature/step-1' -am "feat: first step"
# Continue stacking
gt create 'feature/step-2' -am "feat: second step"
gt create 'feature/step-3' -am "feat: third step"
# Insert branch between current and child
gt create 'feature/step-1.5' --insert -am "feat: inserted step"
| Command | Action |
|---|---|
gt up | Move up the stack (toward children) |
gt down | Move down the stack (toward parent) |
gt top | Jump to stack top |
gt bottom | Jump to stack bottom |
gt checkout | Interactive branch picker |
# Amend current branch (stages all)
gt modify -a
# New commit within same branch
gt modify -acm "fix: address review feedback"
# Commit to a different branch in the stack
git add path/to/file.ts
gt modify --into target-branch -m "feat: add file"
ALWAYS:
gt create for new branchesgt modify for commitsgt submit to pushgt restack after parent changesgt status when uncertainNEVER:
git commit/push/rebase with gt workflowsgit rebase -i (breaks Graphite metadata)Single PR : Navigate to branch, modify directly
gt checkout target-branch
gt modify -acm "fix: address review comment"
gt submit
Multiple PRs in stack : Use absorb from top
gt top
git add .
gt absorb -a
gt submit --stack
Graphite routes changes to correct branches based on file history.
# Move branch to different parent
gt move --onto new-parent
# Move specific branch
gt move --source branch-name --onto target
# After reorganization
gt restack
# Current branch + downstack
gt submit
# Entire stack
gt submit --stack
# Non-interactive (automation)
gt submit --no-interactive
# JSON with parent relationships (preferred for scripts)
gt status
# Visual tree
gt ls
# Recent history
gt log
# Pull trunk, rebase stacks, clean merged
gt sync
# Rebase branches onto updated parents
gt restack
# Undo last gt operation
gt undo
Stack corruption symptoms:
gt status shows unexpected structureSee recovery.md for step-by-step recovery procedures.
Weekly Installs
58
Repository
GitHub Stars
25
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode50
codex48
github-copilot48
gemini-cli47
claude-code46
cursor44
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
125,600 周安装
| View stack | gt status or gt ls | git log --graph |
| Switch branches | gt checkout | git checkout |
| Amend commit | gt modify -a | git commit --amend |
| Multi-PR feedback | gt top && gt absorb -a | Cherry-pick commits manually |