SKILL

sync-worktrees

他の PR を main にマージした後、進行中の各 worktree に main を取り込む (merge) ワークフロー。並行している worktree が main から遅れるのを一括で 解消する。Trigger when the user says: "worktreeにmainを取り込む", "worktreeを最新化", "worktree同期", "mainを取り込む", "sync worktrees", "merge main into worktrees", "update worktrees with main", or similar phrases requesting to bring the default branch into in-flight worktrees.

Original · translation did not pass checks

Target: Target not categorized. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Japanese text

Topics in the source

  • Sync Worktrees Skill
  • 前提条件
  • 手順
  • 1. default ブランチを特定して fetch する
  • 2. 対象 worktree を列挙する
  • 3. 各対象 worktree を順に処理する
  • 4. サマリを返す
  • 並行作業との関係

進行中の worktree(.claude/worktrees/ など)に、マージ済みの最新 default ブランチ(通常 main)を merge で取り込む。複数の worktree を 並行で走らせていて、どれかの PR が main に入った後に残りを一括で追従させる ためのもの。 merge であって rebase ではない。worktree のブランチは PR として公開されて いる前提なので、履歴を書き換える rebase ではなく merge で取り込む。 push はしない。ローカル merge までで止める。push は pre-push hook / CI を 発火させるため、各 worktree での pnpm i 済み確認も含めてユーザーの判断に委ねる。 自動コンフリクト解決はしない。衝突したらその worktree で止めて報告する。 対象リポジトリ内(いずれかの worktree、または main 本体)で実行されていること。 リモート追跡が設定されていること(origin)。 1. default ブランチ名を自動検出する: git rev-parse --abbrev-ref origin/HEAD(例: origin/main → main)。 取得できなければ main、無ければ master にフォールバックする。 2. 最新を取得する: git fetch origin 。 以降この origin/ を取り込み元として使う。 1. git worktree list --porcelain で全 worktree を取得する。 2. 各エントリについて、次を 対象から除外 する: bare の worktree。 detached(detached HEAD)の worktree — 追従先ブランチが無いため。 ブランチが default ブランチそのものの worktree(main 本体は取り込み元なので対象外)。 3. 残った「feature ブランチを持つ worktree」が対象。 4. 引数でブランチ名 / worktree パスが渡された場合は、その 1 つだけに絞る (例: /hane:sync-worktrees feat/key-generator)。 各 worktree のパスを として、cd せず git -C ... で操作する。 1. 作業中・未コミットの保護(skip 判定)。次のいずれかに当たる worktree は merge せずスキップし、理由を控える: 未コミットの変更がある: git -C status --porcelain が非空。 既に merge / rebase / cherry-pick が進行中: の git dir に MERGEHEAD / REBASE

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
kompiro/hane
Source file
skills/sync-worktrees/SKILL.md
Fixed revision
e43182fb7d2abb7ea0ffb21f030479966cd2ee05
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: kompiro/hane · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-10T09:01:55.393Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.