twig-guide
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesetwig CLI Guide
twig CLI 指南
twig is a CLI tool that simplifies git worktree workflows by automating branch
creation, symlinks, and change management in a single command.
twig是一款CLI工具,通过单条命令自动化分支创建、符号链接和变更管理,简化git worktree工作流。
Commands Overview
命令概述
| Command | Purpose |
|---|---|
| Initialize twig configuration |
| Create a new worktree with symlinks |
| Remove worktrees and their branches |
| List all worktrees |
| Remove unneeded worktrees |
| Sync symlinks and submodules to worktrees |
| 命令 | 用途 |
|---|---|
| 初始化twig配置 |
| 创建带有符号链接的新工作树 |
| 删除工作树及其分支 |
| 列出所有工作树 |
| 删除不需要的工作树 |
| 将符号链接和子模块同步到工作树 |
Typical Workflows
典型工作流
Start new feature work
开始新功能开发
Create a new worktree for a feature branch:
bash
twig add feat/new-featureThis creates a worktree at the configured destination directory, creates
a new branch if it doesn't exist, and sets up symlinks.
为功能分支创建新工作树:
bash
twig add feat/new-feature此命令会在配置的目标目录创建工作树,如果分支不存在则创建新分支,并设置符号链接。
Move current changes to a new branch
将当前更改转移到新分支
When you realize current work should be on a different branch:
bash
twig add feat/correct-branch --carryThe flag moves uncommitted changes to the new worktree.
The source worktree becomes clean.
--carry当你意识到当前工作应该放在另一个分支时:
bash
twig add feat/correct-branch --carry--carryCopy changes to a new branch
将更改复制到新分支
When you want changes in both the current and new worktree:
bash
twig add feat/experiment --syncThe flag copies uncommitted changes to both worktrees.
--sync当你希望当前工作树和新工作树都保留更改时:
bash
twig add feat/experiment --sync--syncCarry only specific files
仅转移特定文件
When you want to carry only certain files:
bash
twig add feat/new --carry --file "*.go" --file "cmd/**"当你只想转移某些文件时:
bash
twig add feat/new --carry --file "*.go" --file "cmd/**"Clean up after merging
合并后清理
Remove worktrees for branches that have been merged:
bash
twig cleanThis shows candidates and prompts for confirmation. Use to skip
the prompt.
--yes删除已合并分支对应的工作树:
bash
twig clean此命令会显示候选清理项并提示确认,使用可跳过提示。
--yesForce remove a worktree
强制删除工作树
Remove a worktree even with uncommitted changes:
bash
twig remove feat/abandoned -fUse to also remove locked worktrees.
-ff即使存在未提交的更改,也删除工作树:
bash
twig remove feat/abandoned -f使用还可删除锁定的工作树。
-ffConfiguration
配置
see ./references/configuration.md
请查看 ./references/configuration.md
Command Details
命令详情
For detailed information on each command, refer to:
- ./references/commands/add.md - Create worktrees with sync/carry options
- ./references/commands/remove.md - Remove worktrees and branches
- ./references/commands/list.md - List worktrees
- ./references/commands/clean.md - Clean merged worktrees
- ./references/commands/sync.md - Sync symlinks and submodules
- ./references/commands/init.md - Initialize configuration
- ./references/configuration.md - Configuration file details
如需各命令的详细信息,请参考:
- ./references/commands/add.md - 带有同步/转移选项的工作树创建
- ./references/commands/remove.md - 删除工作树和分支
- ./references/commands/list.md - 列出工作树
- ./references/commands/clean.md - 清理已合并的工作树
- ./references/commands/sync.md - 同步符号链接和子模块
- ./references/commands/init.md - 初始化配置
- ./references/configuration.md - 配置文件详情