Skip navigation
Claude Code に /fork コマンドが入ってた
0:00 / 0:24

Claude Code に /fork コマンドが入ってた

84,012 views

Claude Code に /fork コマンドが入ってた /fork [name] 上記のコマンドで、現在の会話の地点から分岐したセッションを作成可能。[name] はセッション名を記載できる(/renameの挙動と同じ)。/resume で分岐元と行き来ができる。 [name] で指定したセッション名は、--resume などでも復帰可能。例えば、`/fork new-session`とフォークしたら、 claude --resume new-session と入力すれば、new-sessionに復帰できる。 (CHANGELOGに書いてください)

16 Comments

Comments from the original post on X (Twitter)

  • Heppoko | Terminal for Claude & Codex's profile picture

    @Heppoko750151

    私も/forkの考え方が好きすぎて自分でターミナル作ってしまいました。 UIで履歴表示検索してどの会話途中からでもforkできます!

    16 likes

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    検索機能内蔵のforkできるターミナル作るのすごいですね!

    4 likes

  • Heppoko | Terminal for Claude & Codex's profile picture

    @Heppoko750151

    ありがとうございます! これもclaudeとcodexと一緒に作りました。 ここで公開してるのでよかったら触ってみて下さいmm

    13 likes

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    /fork がいつClaude Codeに入ったか、ちゃんと調べてみるとv2.1.8からだった (v2.1.7時点まで無かったので) CHANGELOGは v2.1.7 -> v2.1.9 だったので、番号を飛ばしているせいでリリースノートから省かれたのだろうか🤔

    15 likes

  • K😮n K😀n's profile picture

    @KentaroxKondo

    初歩質問なのですが、IDE拡張機能のClaude Codeって基本使わない方が推奨されるのですか? /fork も試してみたかったのですが、拡張機能の方ですと使えないようでして・・・アップデートが降りてくるタイミングが遅いのか、そもそもターミナル限定の機能になるのかよくわからず

    1 like

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    基本的にはCLI -> IDE拡張の順番で新機能が下りてきます。逆はほぼありません。 IDE側でもforkはそのうち使えるようになると思いますが、もう少しかかると思います。

    1 like

  • K😮n K😀n's profile picture

    @KentaroxKondo

    ありがとうございます。手練れの方々はターミナル版を使用している割合が多いと思うのですが、いち早くアップデートを吸収できる利点が主な動機でしょうか?他にもターミナル版を選ぶ大きなメリットがあればご教示いただきたいです🙇‍♂️

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    Claude Code CLIを使用するメリットはいくつかありますが、ワークフローへの組み込みのしやすさと並列実行の容易性が主な理由です

    1 like

  • Shin / しん's profile picture

    @ryoshin0830

    codexにもいつの間にか実装されてました。便利な機能

    1 like

  • だいち@家族大好きエンジニア's profile picture

    @da_i_chi_dev

    大事なことなのでここでも書く (CHANGELOGに書いてください)

    1 like

  • Yumin's profile picture

    @YuminAI

    Which terminal are you using? It’s beautiful

    1 like

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    Thanks. It's Ghostty. My settings are attached to the post reply.

    1 like

  • Geminoo's profile picture

    @anothergemino

    double check the attached pic in Claude docs the bottom should be claude --resume xyz789 ? cc @bcherny @trq212 and `claude --continue --fork-session` only appended to latest /fork <session> ? I'm not sure

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    @bcherny @trq212 its not. xyz789 is forked from abc123 xyz789 is not created util you run claude --resume abc123 --fork-session after you run above command and xyz789 is created, you can resume session with claude --resume xyz789. --fork-session is just branching base session (abc123)

    1 like

  • Geminoo's profile picture

    @anothergemino

    @bcherny @trq212 it's confused. check doc attached pic notice it have (new ID) rather than xyz789! `claude --resume abc123 --fork-session` could be used when new fork seesion-xyz789 already created ? If not , should /rename then quit then `claude --continue/resume xyz789` ?

  • Oikon | Claude Code深掘りガイド's profile picture

    @oikon48

    session-ID and session-name are different. This is confusing point using --resume. --resume can take both session-ID and session-name, but --fork-session creates new session-ID. If you run , cluade --resume abc123 --fork-session it will create new session-id, e.g.) xyz789 (session-id) If you run, cluade --resume abc123 --fork-session again, it will create another new session-id, e.g.) vvv999 (session-id) xyz789 and vv999 are both forked from the head of abc123. FYI: /fork command is also doing same, but if you run /fork [name], this is equivalent to /fork + /rename.

    1 like