Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计提醒

gtGT 命令行

Agent Skill

gt 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,479

周安装

61

GitHub Stars

81

下载量

483
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gt(GT 命令行)
来源仓库:https://github.com/dagster-io/erk
仓库路径:skills/gt
安装命令:
npx skills add https://github.com/dagster-io/erk --skill gt
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dagster-io/erk --skill gt

简介

gt 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合整理项目状态和变更事项。

  • 适用于围绕仓库状态、代码变更或协作事项进行信息组织和分析。
  • 通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 安装前需确认权限范围和维护状态,注意可能触发联网或文件操作。
  • gt 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Graphite

Overview

Graphite (gt) is a CLI tool for managing stacked pull requests - breaking large features into small, incremental changes built on top of each other. This skill provides the mental model, command reference, and workflow patterns needed to work effectively with gt.

CRITICAL: Always Use --no-interactive

NEVER invoke any gt command without --no-interactive. This is a global flag inherited by every gt command — not a per-command option.

Without --no-interactive, gt may open prompts, pagers, or editors that hang indefinitely in agent/CI contexts. The --force flag does NOT prevent prompts — you must use --no-interactive separately.

# WRONG - may hang waiting for user input
gt sync
gt submit --force
gt track --parent main

# CORRECT - always pass --no-interactive
gt sync --no-interactive
gt submit --no-interactive
gt track --parent main --no-interactive
gt restack --no-interactive
gt create my-branch -m "message" --no-interactive

What --interactive controls (all disabled by --no-interactive):

  • Prompts (confirmation dialogs in sync, delete, submit, etc.)
  • Pagers (output paging in log)
  • Editors (commit message editing in create/modify, PR metadata in submit)
  • Interactive selectors (branch selection in checkout, move, track)

Note: gt modify --interactive-rebase is a separate, unrelated flag that starts a git interactive rebase. It is NOT the same as the global --interactive.

Core Mental Model

Stacks are Linear Chains

A stack is a sequence of branches where each branch (except trunk) has exactly one parent:

VALID STACK (linear):
main → feature-a → feature-b → feature-c

INVALID (not a stack):
main → feature-a → feature-b
            └─────→ feature-x

Key Concepts

  • Parent-Child Relationships: Every branch tracked by gt (except trunk) has exactly one parent branch it builds upon
  • Auto-restacking: When modifying a branch, gt automatically rebases all upstack branches to include changes
  • Directional Navigation:

- Downstack/Down: Toward trunk (toward the base) - gt down moves from feature-b → feature-a → main - Upstack/Up: Away from trunk (toward the tip) - gt up moves from feature-a → feature-b → feature-c

  • Trunk: The main branch (usually main or master) that all stacks build upon

Stack Visualization - CRITICAL MENTAL MODEL

When working with Graphite stacks, always visualize trunk at the BOTTOM:

TOP ↑    feat-3  ← upstack (leaf)
         feat-2
         feat-1
BOTTOM ↓ main    ← downstack (trunk)

Directional Terminology - MUST UNDERSTAND

  • UPSTACK / UP = away from trunk = toward TOP = toward leaves
  • DOWNSTACK / DOWN = toward trunk = toward BOTTOM = toward main

Detailed Examples

Given stack: main → feat-1 → feat-2 → feat-3

If current branch is feat-1:

  • Upstack: feat-2, feat-3 (children, toward top)
  • Downstack: main (parent, toward bottom)

If current branch is feat-3 (at top):

  • Upstack: *(nothing, already at top/leaf)*
  • Downstack: feat-2, feat-1, main (ancestors, toward bottom)

Why This Mental Model Is Critical

🔴 Commands depend on this visualization:

  • gt up / gt down navigate the stack
  • land-stack traverses branches in specific direction
  • Stack traversal logic (parent/child relationships)

🔴 Common mistake: Thinking "upstack" means "toward trunk"

  • WRONG: upstack = toward main ❌
  • CORRECT: upstack = away from main ✅

🔴 PR landing order: Always bottom→top (main first, then each layer up)

Metadata Storage

All gt metadata is stored in the shared .git directory (accessible across worktrees):

  • .git/.graphite_repo_config - Repository-level configuration (trunk branch)
  • .git/.graphite_cache_persist - Branch relationships (parent-child graph)
  • .git/.graphite_pr_info - Cached GitHub PR information

Important: Metadata is shared across all worktrees since it's in the common .git directory.

Essential Commands

Remember: ALL gt commands below must include --no-interactive (see CRITICAL: Always Use --no-interactive above).

Common Workflow Commands

CommandAliasPurpose
gt create [name]gt cCreate new branch stacked on current branch and commit staged changes
gt modifygt mModify current branch (amend commit) and auto-restack children
gt submitgt sPush branches and create/update PRs
gt submit --stackgt ssSubmit entire stack (up + down)
gt sync-Sync from remote and prompt to delete merged branches

Navigation Commands

CommandAliasPurpose
gt up [steps]gt uMove up stack (away from trunk)
gt down [steps]gt dMove down stack (toward trunk)
gt topgt tMove to tip of stack
gt bottomgt bMove to bottom of stack
gt checkout [branch]gt coInteractive branch checkout

Stack Management

CommandPurpose
gt restackEnsure each branch has its parent in git history
gt moveRebase current branch onto different parent
gt foldFold branch's changes into parent
gt splitSplit current branch into multiple single-commit branches
gt logVisualize stack structure

Branch Info & Management

CommandPurpose
gt branch infoShow branch info (parent, children, commit SHA)
gt parentShow parent branch name
gt childrenShow children branch names
gt track [branch]Start tracking branch with gt (set parent)
gt untrack [branch]Stop tracking branch with gt
gt delete [name]Delete branch and update metadata
gt rename [name]Rename branch and update metadata

Workflow Patterns

Pattern 1: Creating a New Stack

Build a feature in multiple reviewable chunks:

# 1. Start from trunk
gt checkout main --no-interactive
git pull

# 2. Create first branch
gt create phase-1 -m "Add API endpoints" --no-interactive
# ... make changes ...
git add .
gt modify -m "Add API endpoints" --no-interactive

# 3. Create second branch on top
gt create phase-2 -m "Update frontend" --no-interactive
# ... make changes ...
git add .
gt modify -m "Update frontend" --no-interactive

# 4. Submit entire stack
gt submit --stack --no-interactive

# Result: 2 PRs created
# PR #101: phase-1 (base: main)
# PR #102: phase-2 (base: phase-1)

Pattern 2: Responding to Review Feedback

Update a branch in the middle of a stack:

# Navigate down to target branch
gt down --no-interactive  # Repeat as needed

# Make changes
# ... edit files ...
git add .

# Modify (auto-restacks upstack branches)
gt modify -m "Address review feedback" --no-interactive

# Resubmit stack
gt submit --stack --no-interactive

Pattern 3: Adding to Existing Stack

Insert a new branch in the middle:

# Checkout the parent where you want to insert
gt checkout phase-1 --no-interactive

# Create new branch with --insert
gt create phase-1.5 --insert -m "Add validation" --no-interactive

# Submit new PR
gt submit --no-interactive

Pattern 4: Syncing After Merges

Clean up after PRs merge on GitHub:

# Run sync (--no-interactive auto-confirms branch deletion)
gt sync --no-interactive

# Result:
# - Merged branches deleted locally
# - Remaining branches rebased onto trunk
# - PR bases updated on GitHub

Pattern 5: Splitting Large Changes

Break up a large commit into reviewable pieces:

# Checkout branch with large commit
gt checkout large-feature --no-interactive

# Split into single-commit branches
gt split --no-interactive

# Rename branches meaningfully
gt rename add-api-endpoints --no-interactive
gt up --no-interactive
gt rename add-frontend --no-interactive
gt up --no-interactive
gt rename add-tests --no-interactive

# Submit
gt submit --stack --no-interactive

Common Mistakes to Avoid

  1. Don't use git rebase directly: Use gt modify or gt restack - gt needs to update metadata during rebasing
  2. Don't delete branches with git branch -d: Use gt delete - metadata needs to be updated to re-parent children
  3. Don't assume gt submit only affects current branch: It submits downstack too (all ancestors). Use gt submit --stack to include upstack
  4. Don't forget to gt sync after merges: Stale branches accumulate and metadata gets outdated
  5. ⚠️ NEVER use gt log short for branch status: The output format is counterintuitive and confuses agents. Use gt branch info, gt parent, or gt children for explicit metadata access instead

Quick Decision Tree

When to use gt commands:

  • Start new workgt create (sets parent relationship)
  • Edit current branchgt modify (auto-restacks children)
  • Navigate stackgt up/down/top/bottom (move through chain)
  • View structuregt log (see visualization)
  • Get parent branchgt branch info (parse "Parent:" line)
  • Get branch relationshipsgt parent / gt children (quick access)
  • Submit PRsgt submit --stack (create/update all PRs)
  • After mergesgt sync (clean up + rebase)
  • Reorganizegt move (change parent)
  • Combine workgt fold (merge into parent)
  • Split workgt split (break into branches)

Resources

references/

Contains detailed command reference and comprehensive mental model documentation:

  • gt-reference.md - Complete command reference, metadata format details, and advanced patterns

Load this reference when users need detailed information about specific gt commands, metadata structure, or complex workflow scenarios.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.22%
按下载量换算185

Claude

29.65%
按下载量换算143

Cursor

18.13%
按下载量换算88

Gemini CLI

9.98%
按下载量换算48

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills