dubstack

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DubStack CLI

DubStack CLI

Key Concepts

核心概念

  • Stack: Chain of dependent branches (e.g.,
    main
    ->
    feat/a
    ->
    feat/b
    )
  • Root: The base branch (usually
    main
    )
  • Restacking: Rebasing branches onto their updated parents (e.g., after parent changes)
  • Submit: Pushing branches and creating/updating GitHub PRs for the entire stack
  • Stack: 相互依赖的分支链(例如:
    main
    ->
    feat/a
    ->
    feat/b
  • Root: 基础分支(通常为
    main
  • Restacking: 将分支变基到更新后的父分支上(例如父分支变更后)
  • Submit: 推送分支并为整个分支栈创建/更新GitHub PR

Prerequisites

前置条件

  1. Install:
    npm install -g dubstack
    or
    brew install wiseiodev/dubstack/dubstack
  2. Auth: ensure
    gh auth login
    is done (DubStack uses
    gh
    CLI for PRs)
  3. Init: Auto-initialized on first
    dub create
    (or run
    dub init
    )
  1. 安装:
    npm install -g dubstack
    brew install wiseiodev/dubstack/dubstack
  2. 认证: 确保已完成
    gh auth login
    (DubStack 使用
    gh
    CLI 处理PR相关操作)
  3. 初始化: 首次执行
    dub create
    时会自动初始化(或手动运行
    dub init

Quick Decision Trees

快速决策指南

"I need to start a new feature or stack"

"我需要开始开发新功能或创建分支栈"

  • Create branch & commit:
    dub create <name> -am "<msg>"
  • Create branch only:
    dub create <name>
    (then git add/commit manually)
  • 创建分支并提交:
    dub create <name> -am "<msg>"
  • 仅创建分支:
    dub create <name>
    (之后手动执行git add/commit)

"I need to visualize my work"

"我需要查看我的工作状态"

  • See stack tree:
    dub log
  • Switch branches (interactive):
    dub checkout
    (or
    dub co
    )
  • Switch branch directly:
    dub checkout <name>
  • 查看分支栈树状图:
    dub log
  • 交互式切换分支:
    dub checkout
    (或别名
    dub co
  • 直接切换分支:
    dub checkout <name>

"I need to update code"

"我需要更新代码"

  • Modify current branch: standard git workflow (
    git add
    ,
    git commit
    )
  • 修改当前分支: 使用标准Git工作流(
    git add
    ,
    git commit
  • 更新父分支:
    dub co <parent>
    ,修改后提交
  • 将父分支变更同步到子分支:
    dub restack

"I need to update code"

"我需要提交我的工作成果"

  • Modify current branch: standard git workflow (
    git add
    ,
    git commit
    )
  • Update parent branch:
    dub co <parent>
    , modify, commit
  • Propagate parent changes to children:
    dub restack
  • Propagate parent changes to children:
    dub restack
  • 提交整个分支栈:
    dub ss
    (为栈中所有分支创建/更新PR)
  • 预览提交效果:
    dub ss --dry-run

"I need to submit my work"

"我操作出错了"

  • Submit entire stack:
    dub ss
    (sets up PRs for all branches in stack)
  • Preview submission:
    dub ss --dry-run
  • 撤销上一次DubStack操作:
    dub undo
    (撤销创建/重排栈操作)

"I made a mistake"

命令参考

  • Undo last DubStack action:
    dub undo
    (reverses create/restack)
命令描述
dub create <name> -am "msg"
创建分支、暂存所有变更并提交(类似
gt create
dub log
显示当前分支栈的ASCII树状图
dub checkout
交互式分支选择器(别名
dub co
dub ss
推送分支并创建/更新PR(
dub submit
的别名)
dub restack
将栈中所有分支变基到各自的父分支上
dub undo
撤销上一次
create
restack
操作
dub init
手动初始化DubStack(可选)

Command Reference

故障排除

CommandDescription
dub create <name> -am "msg"
Create branch, stage all, commit (like
gt create
)
dub log
Show ASCII tree of current stack
dub checkout
Interactive branch picker (alias
dub co
)
dub ss
Push branches & create/update PRs (alias for
dub submit
)
dub restack
Rebase all branches in stack onto their parents
dub undo
Undo last
create
or
restack
operation
dub init
Manually initialize DubStack (optional)
问题解决方案
未认证运行
gh auth login
分支名称已存在选择其他名称
重排栈时出现冲突解决文件冲突,执行
git add
,
git rebase --continue
需要与main分支同步
git checkout main && git pull
,然后执行
dub restack
意外修改了错误的分支如果是通过DubStack创建的分支,执行
dub undo
;否则使用标准Git撤销操作

Troubleshooting

完整文档

ProblemSolution
"Not authenticated"Run
gh auth login
"Branch name exists"Choose different name
"Conflict during restack"Resolve files,
git add
,
git rebase --continue
"Need to sync with main"
git checkout main && git pull
, then
dub restack
"Accidentally modified wrong branch"
dub undo
if created via dub, or standard git undo
请查看仓库根目录下的
QUICKSTART.md
获取完整使用教程。

Full Documentation

See
QUICKSTART.md
in the repo root for a complete walkthrough.