git: worktree一括操作
スクリプトは scripts/ に同梱済み。スキル起動時に示されるベースディレクトリ("Base directory for this skill: ...")を使って実行する。
/git worktrees [dir]
bash <base_dir>/scripts/worktrees.sh [dir]
dir省略時はカレントディレクトリ- clean(ahead:0 behind:0 untracked:0)は
✓で表示、それ以外は詳細を表示
/git find <hash> [dir]
bash <base_dir>/scripts/find-commit.sh <hash> [dir]
hashは前方一致(短縮形OK)dir省略時はカレントディレクトリ- 結果は
FOUND/noneで各worktreeごとに表示
/git untracked [dir]
bash <base_dir>/scripts/untracked.sh [dir]
dir省略時はカレントディレクトリ- ignoredを含むgit管理外ファイル・ディレクトリを一覧表示
- 対象は単一リポジトリ
- read-only
/git rebase <parent> [child]
child を parent にrebaseする。child 省略時はカレントブランチ。
手順
- 子ブランチのworktreeで
git rebase <parent>を実行 - コンフリクト発生時は
git rebase --abortしてユーザーに報告して終了する- コンフリクトしたファイル一覧と概要を報告する
- 自己判断での解決をしない
worktreeの場所
ブランチ名からworktreeパスを解決する:
git worktree list --porcelain | grep -B2 "branch refs/heads/<branch-name>" | head -1
/git remove-worktree <branch|path>
bash <base_dir>/scripts/remove-worktree.sh <branch|path>
branch指定時は worktree パスを自動解決- 失敗したらユーザーに報告し、作業を中断する