npx skills add https://github.com/kalbasit/ncps --skill graphite此技能提供使用 Graphite (gt) 导航分支和重新堆叠堆栈的说明。
gt ss、gt submit 或 gt squash。这些命令是禁止使用的。gt 命令在堆栈中的分支之间移动。gt restack 进行本地堆栈维护,使用 gt get 或 gt sync 从远程同步。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用以下命令在分支堆栈中导航:
| 命令 | 操作 |
|---|---|
gt up | 移动到堆栈中当前分支正上方的分支。 |
gt down | 移动到当前分支的父分支。 |
gt prev | 按照 gt log 的顺序,移动到堆栈中的前一个分支。 |
gt next | 按照 gt log 的顺序,移动到堆栈中的下一个分支。 |
gt top | 移动到当前堆栈的顶端分支。 |
gt bottom | 移动到当前堆栈中最接近主干的分支。 |
gt ls | 以简短格式显示所有被跟踪的分支及其依赖关系。 |
使用以下命令维护您的堆栈:
| 命令 | 操作 |
|---|---|
gt restack | 确保当前堆栈中的每个分支在其 Git 提交历史中都包含其父分支,必要时进行变基。这用于维护本地堆栈,不会触及上游。 |
gt get | 从远程同步特定分支或堆栈(从主干到分支)。如果未提供分支,则同步当前堆栈。 |
gt sync | 从远程同步所有分支(包括主干),并提示删除已合并的分支。 |
使用以下命令管理堆栈内的分支。
| 命令 | 操作 |
|---|---|
gt create <branch-name> | 创建具有给定名称的新分支,并将其堆叠在当前分支之上。始终遵循 /gt-create 工作流。 |
gt move | 将当前分支变基到目标分支上,并重新堆叠其后续分支。使用 --onto <target-branch> 以避免交互模式。 |
gt split | 将当前分支拆分为多个分支。此命令是高度交互式的。 |
使用 gt modify 管理堆栈内的提交。它会自动重新堆叠后续分支。
| 命令 | 操作 |
|---|---|
gt modify --amend | 修改当前分支的头部提交。 |
gt modify -c | 在当前分支上创建新提交。推荐用于添加新更改,同时保持历史记录清晰。 |
许多 Graphite 命令(gt modify、gt move、gt split、gt restack)默认是交互式的,会打开选择器、编辑器或专用菜单。
gt restack 或 gt move 遇到冲突,Graphite 将暂停。请按照以下步骤解决:
git status 或查看错误输出,以识别存在合并冲突的文件。<<<<<<<、=======、>>>>>>>)。确保代码功能正确,并包含双方的必要更改。gt add -A(或 git add <file>)将冲突标记为已解决。gt continue 以恢复重新堆叠过程。重要:绝不使用 git rebase --continue,因为 Graphite 会跟踪其自身状态。gt move 的 --onto),以避免交互式选择器。问题:使用标准的 git commit 或 git commit --amend 无法更新 Graphite 的内部堆栈元数据,并且不会触发后续分支的自动重新堆叠。这可能导致堆栈不同步,Graphite 无法感知新的提交或更改。
解决方案:对于提交和分支管理,始终优先使用 gt 命令,而非其标准的 git 对应命令。
gt create <branch-name> 代替 git checkout -b <branch-name>。gt modify -c -m "message" 代替 git commit -m "message"。gt modify --amend 代替 git commit --amend。gt modify -cam "message" 代替 git commit -am "message"。好处:
如果您不小心将更改提交到了堆栈中的错误分支:
git stash 将其安全保存。gt create <new-branch> 以安全地移动头部。
2. gt down 以移回父分支。
3. git reset --hard HEAD~1(现在安全了,因为提交已保存在新分支中)。git reset HEAD~1(软重置以将更改保留在工作树中)。
2. gt down/gt up 到目标分支。
3. gt modify -c 或 gt modify --amend 以合并更改。git stash pop 以恢复您的工作。gt restack,以确保所有后续分支都根据父分支的新状态进行了更新。[!CAUTION] 在任何情况下都不得使用以下命令:
gt ssgt submitgt squash
这些命令被严格禁止,以确保 PR 提交、更新和分支压缩通过手动或指定的工作流来处理。
每周安装量
105
仓库
GitHub 星标数
284
首次出现时间
2026年1月21日
安全审计
安装于
opencode91
codex88
github-copilot87
claude-code86
gemini-cli82
amp73
This skill provides instructions for navigating branches and restacking stacks using Graphite (gt).
gt ss, gt submit, or gt squash. These commands are forbidden.gt commands to move between branches in a stack.gt restack for local stack maintenance and gt get or gt sync for syncing from remote.Use these commands to navigate through a stack of branches:
| Command | Action |
|---|---|
gt up | Move to the branch immediately above the current one in the stack. |
gt down | Move to the parent of the current branch. |
gt prev | Move to the previous branch in the stack, as ordered by gt log. |
gt next | Move to the next branch in the stack, as ordered by gt log. |
gt top |
Maintain your stack with these commands:
| Command | Action |
|---|---|
gt restack | Ensure each branch in the current stack has its parent in its Git commit history, rebasing if necessary. This maintains the local stack and does NOT reach out to upstream. |
gt get | Sync a specific branch or stack from remote (trunk to branch). If no branch is provided, it syncs the current stack. |
gt sync | Sync all branches (including trunk) from remote and prompt to delete merged branches. |
Use these commands to manage branches within your stack.
| Command | Action |
|---|---|
gt create <branch-name> | Create a new branch with the given name and stack it on top of the current one. Always follow the/gt-create workflow. |
gt move | Rebase the current branch onto a target branch and restack descendants. Use --onto <target-branch> to avoid interactive mode. |
gt split | Split the current branch into multiple branches. This command is highly interactive. |
Use gt modify to manage commits within your stack. It automatically restacks descendants.
| Command | Action |
|---|---|
gt modify --amend | Amend the head commit of the current branch. |
gt modify -c | Create a new commit on the current branch. Preferred for adding new changes while keeping history clean. |
Many Graphite commands (gt modify, gt move, gt split, gt restack) are interactive by default, opening selectors, editors, or specialized menus.
gt restack or gt move hits a conflict, Graphite will pause. Follow these steps to resolve:
git status or look at the error output to identify files with merge conflicts.<<<<<<<, =======, >>>>>>>). Ensure the code is functionally correct and includes necessary changes from both sides.gt add -A (or git add <file>) to mark the conflicts as resolved.The Problem : Using standard git commit or git commit --amend fails to update Graphite's internal stack metadata and does not trigger automatic restacking of descendants. This can lead to a desynchronized stack where Graphite is unaware of the new commits or changes.
The Solution : Always prefer gt commands over their standard git counterparts for commit and branch management.
gt create <branch-name> instead of git checkout -b <branch-name>.gt modify -c -m "message" instead of git commit -m "message".gt modify --amend instead of git commit --amend.gt modify -cam "message" instead of git commit -am "message".Benefits :
If you accidentally commit a change to the wrong branch in a stack:
git stash to keep it safe.gt create <new-branch> to safely move the head.gt down to move back to the parent.git reset --hard HEAD~1 (Safe now because the commit is preserved in the new branch).git reset HEAD~1 (Soft reset to keep changes in the working tree).gt down/gt up to the target branch.gt modify -c or to incorporate the changes.[!CAUTION] DO NOT use the following commands under any circumstances:
gt ssgt submitgt squash
These commands are strictly forbidden to ensure that PR submission, updates, and branch squashing are handled manually or through specified workflows.
Weekly Installs
105
Repository
GitHub Stars
284
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode91
codex88
github-copilot87
claude-code86
gemini-cli82
amp73
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
116,600 周安装
| Move to the tip branch of the current stack. |
gt bottom | Move to the branch closest to trunk in the current stack. |
gt ls | Display all tracked branches and their dependency relationships in a short format. |
gt continue to resume the restack process. IMPORTANT : NEVER use git rebase --continue as Graphite tracks its own state.--onto for gt move) to avoid interactive selectors.gt modify --amendgit stash pop to resume your work.gt restack to ensure all descendant branches are updated with the parent's new state.