jpskill.com
🛠️ 開発・MCP コミュニティ

graphite-cli

This skill should be used to answer questions and guide workflows related to the Graphite CLI. It assists with creating, managing, submitting, and synchronizing stacked code changes (diffs).

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o graphite-cli.zip https://jpskill.com/download/17720.zip && unzip -o graphite-cli.zip && rm graphite-cli.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17720.zip -OutFile "$d\graphite-cli.zip"; Expand-Archive "$d\graphite-cli.zip" -DestinationPath $d -Force; ri "$d\graphite-cli.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して graphite-cli.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → graphite-cli フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
3

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Graphite CLI ガイド

このスキルは、Graphite コマンドラインインターフェース (CLI) を操作するための手順に関する知識を提供します。初期設定から高度なスタック操作まで、積み上げられたプルリクエストの作成と管理のライフサイクル全体をカバーします。

このスキルを使用するタイミング

ユーザーのリクエストに gt コマンドの使用、積み上げられたプルリクエストの管理、または Graphite ワークフローに関する問い合わせが含まれる場合に、このスキルを有効にします。ブランチの作成、PR の送信、トランクブランチとの同期、スタックの構造の変更などのタスクを処理するように設計されています。

主要な概念

  • Stack: 一連の小さく、段階的で、依存関係のあるブランチ。各ブランチは個別の PR であり、前のブランチを基に構築されます。
  • Trunk: リポジトリのプライマリブランチ(通常は main または master)。すべてのスタックがここから派生し、最終的にマージされます。

I. 初期設定

git リポジトリで Graphite の使用を開始するには、初期化する必要があります。

  1. 認証: gt auth を実行して、認証トークンを介して CLI を GitHub アカウントに接続します。
  2. リポジトリの初期化: リポジトリのルートに移動し、gt init を実行します。このコマンドは、トランクブランチを選択するように求めます。

II. コアワークフロー: 変更の作成と送信

このワークフローでは、ブランチの作成、送信、更新の基本的なループについて説明します。

ステップ 1: ブランチの作成

新しいブランチを作成して変更をコミットするには、gt create を使用します。このコマンドは、git addgit commit、および git checkout -b を置き換えます。新しいブランチは、現在チェックアウトされているブランチに積み重ねられます。

コマンド エイリアス/フラグ 説明
gt create gt c 新しいブランチを作成し、ステージングされた変更をコミットします。
gt create -m <MSG> gt c -m 特定のコミットメッセージでブランチを作成します。
gt create -a gt c -a コミットする前に、ステージングされていないすべての変更をステージングします。
gt create -am <MSG> gt c -am すべての変更のステージングとメッセージの追加を組み合わせます。

例: main から現在のすべてのファイル変更とコミットメッセージを使用してブランチを作成するには:

  1. トランクをチェックアウトします: gt checkout main
  2. コードを編集します。
  3. ブランチを作成します: gt create -am "feat: Add new user model"

ステップ 2: レビューのために送信

ブランチ(またはブランチのスタック)をプッシュして、GitHub でプルリクエストを開くには、gt submit を使用します。

コマンド エイリアス/フラグ 説明
gt submit 現在のブランチをプッシュし、その PR を作成または更新します。
gt submit --stack gt ss 現在のスタック内のすべてのブランチを、トランクから現在のブランチまでプッシュし、それぞれに個別の PR を作成/更新します。
gt submit -d PR をドラフトとして送信します。
gt pr 現在のブランチの GitHub PR ページをブラウザで開きます。

例: 3 部構成のスタック全体をレビューのために送信するには:

  1. スタックの最上位ブランチ (part-3) に移動します。
  2. gt submit --stack --reviewers alice,bob を実行します。

ステップ 3: 変更と更新

フィードバックに基づいてブランチを更新するには、コードを編集し、gt modify を使用してコミットを修正します。

コマンド エイリアス/フラグ 説明
gt modify gt m 現在のブランチのコミットを、ステージングされた変更で修正します。
gt modify -a gt m -a ステージングされた変更とステージングされていないすべての変更でコミットを修正します。これは最も一般的な更新コマンドです。

例: PR へのリクエストされた変更を適用するには:

  1. 関連するファイルを編集します。
  2. gt modify -a を実行して、変更をコミットに修正します。
  3. gt submit を実行して、リモート PR を更新します。

III. スタックの管理とナビゲーション

スタックの可視化

ブランチの依存関係構造を表示するには、gt log short を使用します。

コマンド エイリアス 説明
gt log short gt ls トラッキングされているすべてのブランチと、それらの依存関係をコンパクトなツリー形式で表示します。

スタックのナビゲーション

これらのコマンドを使用して、スタック内のブランチ間を効率的に移動します。

コマンド エイリアス 機能
gt up gt u 子ブランチ(アップスタック)に切り替えます。
gt down gt d 親ブランチ(ダウンスタック)に切り替えます。
gt top gt t 現在のスタックの最上位ブランチ(先端)に切り替えます。
gt bottom gt b 現在のスタックの最下位ブランチに切り替えます。
gt checkout gt co インタラクティブなセレクターを開き、トラッキングされている任意のブランチを選択します。

IV. 同期とコンフリクトの解決

スタックを最新の状態に保つ

トランクからの最新の変更でスタックを更新するには、gt sync を使用します。

gt sync によって実行されるアクション:

  1. 最新のリモート状態をフェッチします。
  2. 最新の変更をトランクブランチ (main) にプルします。
  3. 開いているすべてのブランチを更新されたトランクに再スタック(リベース)します。
  4. リモートでマージまたはクローズされたローカルブランチを削除するように求めます。

コンフリクトの解決

gt sync または gt modify がマージコンフリクトのために一時停止した場合は、次の手順に従います。

  1. コンフリクトの解決: エラーメッセージにリストされているファイルを開き、コンフリクトを手動で解決します。
  2. 変更のステージング: git add . を実行して、コンフリクトを解決済みとしてマークします。
  3. 続行: gt continue を実行して、Graphite が元の sync または modify 操作を完了できるようにします。

V. 高度なスタック操作

これらのコマンドは、スタックを再構築するために使用されます。

コマンド 説明
gt move 現在のブランチとその子を新しい親にリベースします。ブランチの依存関係を変更する場合に使用します(例: gt move --onto main)。
gt fold 現在のブランチの変更を親ブランチに結合(スカッシュ)し、現在のブランチを削除します。
gt split コミットごと、またはファイルチャンクをインタラクティブに選択して、現在のブランチを 2 つ以上の新しいブランチに分割します。
gt create --insert 現在のブランチとその親の間に新しいブランチを作成して挿入します。
gt absorb ステージングされていない変更を、最も関連性の高いダウンスタックコミットに自動的に適用します。フィードバックの配布に役立ちます。

(原文はここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Graphite CLI Guide

This skill provides procedural knowledge for working with the Graphite command-line interface (CLI). It covers the entire lifecycle of creating and managing stacked pull requests, from initial setup to advanced stack manipulation.

When to Use This Skill

Activate this skill when a user's request involves using the gt command, managing stacked pull requests, or inquiring about the Graphite workflow. It is designed to handle tasks such as creating branches, submitting PRs, synchronizing with the trunk branch, and modifying the structure of a stack.

Core Concepts

  • Stack: A series of small, incremental, and dependent branches. Each branch is a distinct PR, building on the previous one.
  • Trunk: The primary branch of the repository (usually main or master) from which all stacks originate and into which they are eventually merged.

I. Initial Setup

To begin using Graphite in a git repository, it must be initialized.

  1. Authenticate: Run gt auth to connect the CLI to your GitHub account via an auth token.
  2. Initialize Repository: Navigate to the repository root and run gt init. This command will prompt to select the trunk branch.

II. Core Workflow: Creating & Submitting Changes

This workflow covers the fundamental loop of creating, submitting, and updating branches.

Step 1: Create a Branch

To create a new branch and commit changes, use gt create. This command replaces git add, git commit, and git checkout -b. The new branch will be stacked on the currently checked-out branch.

Command Alias/Flags Description
gt create gt c Creates a new branch and commits staged changes.
gt create -m <MSG> gt c -m Creates a branch with a specific commit message.
gt create -a gt c -a Stages all unstaged changes before committing.
gt create -am <MSG> gt c -am Combines staging all changes and adding a message.

Example: To create a branch from main with all current file changes and a commit message:

  1. Checkout the trunk: gt checkout main
  2. Make code edits.
  3. Create the branch: gt create -am "feat: Add new user model"

Step 2: Submit for Review

To push a branch (or a stack of branches) and open pull requests on GitHub, use gt submit.

Command Alias/Flags Description
gt submit Pushes the current branch, creating or updating its PR.
gt submit --stack gt ss Pushes all branches in the current stack, from trunk up to the current branch, creating/updating a distinct PR for each.
gt submit -d Submits the PR as a draft.
gt pr Opens the GitHub PR page for the current branch in a browser.

Example: To submit an entire 3-part stack for review:

  1. Navigate to the top branch of the stack (part-3).
  2. Run gt submit --stack --reviewers alice,bob

Step 3: Modify and Update

To update a branch with feedback, edit the code and use gt modify to amend the commit.

Command Alias/Flags Description
gt modify gt m Amends the commit on the current branch with staged changes.
gt modify -a gt m -a Amends the commit with all staged and unstaged changes. This is the most common update command.

Example: To apply a requested change to a PR:

  1. Edit the relevant files.
  2. Run gt modify -a to amend the commit with your changes.
  3. Run gt submit to update the remote PR.

III. Stack Management & Navigation

Visualizing the Stack

To see the dependency structure of your branches, use gt log short.

Command Alias Description
gt log short gt ls Displays all tracked branches and their dependency relationships in a compact tree format.

Navigating the Stack

Use these commands to move efficiently between branches in a stack.

Command Alias Function
gt up gt u Switches to the child branch (upstack).
gt down gt d Switches to the parent branch (downstack).
gt top gt t Switches to the highest branch (tip) of the current stack.
gt bottom gt b Switches to the lowest branch of the current stack.
gt checkout gt co Opens an interactive selector to choose any tracked branch.

IV. Synchronization & Conflict Resolution

Keeping the Stack Up-to-Date

To update your stack with the latest changes from the trunk, use gt sync.

Actions performed by gt sync:

  1. Fetches the latest remote state.
  2. Pulls the latest changes into the trunk branch (main).
  3. Restacks (rebases) all of your open branches onto the updated trunk.
  4. Prompts to delete any local branches that have been merged or closed remotely.

Resolving Conflicts

If gt sync or gt modify pauses due to a merge conflict, follow these steps:

  1. Resolve Conflicts: Open the files listed in the error message and resolve the conflicts manually.
  2. Stage Changes: Mark the conflicts as resolved by running git add ..
  3. Continue: Run gt continue to allow Graphite to complete the original sync or modify operation.

V. Advanced Stack Manipulation

These commands are used to restructure a stack.

Command Description
gt move Rebases the current branch and its children onto a new parent. Use this to change a branch's dependency (e.g., gt move --onto main).
gt fold Combines (squashes) the current branch's changes into its parent branch and deletes the current branch.
gt split Splits the current branch into two or more new branches, either by commit or by interactively selecting file hunks.
gt create --insert Creates and inserts a new branch between the current branch and its parent.
gt absorb Automatically applies unstaged changes to the most relevant downstack commits. Useful for distributing feedback fixes across multiple PRs at once.

Bundled Resources

  • references/graphite_cli_guide.md: The complete and unabridged guide for the Graphite CLI. Consult this file for detailed explanations of every command and workflow, including collaboration (gt get, gt freeze) and multi-trunk support.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。