git-worktree
Git worktreeを使用した並行作業管理。実装開始時にworktreeを作成し、完了時に削除する。
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Git Worktree Management (gwq)
軽微な修正以外の実装作業は、gwqを使ってworktreeで作業する。
0. 前提条件
- gwqはmise管理によりインストール済み
- 参考: https://github.com/d-kuro/gwq
1. Worktree 作成
1.1 既存worktree確認
gwq list
1.2 新規ブランチでworktree作成(推奨)
# 新規ブランチ + worktree を作成
gwq add -b feature/xxx
# 作成後、worktreeに移動
cd $(gwq get feature/xxx)
1.3 現在のブランチでworktree作成
gwq add
cd $(gwq get <branch-name>)
1.4 依存関係インストール
# lock fileを検出してインストール
if [ -f "bun.lockb" ]; then
bun install
elif [ -f "pnpm-lock.yaml" ]; then
pnpm install
fi
2. 作業中
2.1 worktree内でコマンド実行
# cdなしでworktree内でコマンド実行
gwq exec feature/xxx -- bun test
gwq exec feature/xxx -- bun run lint
gwq exec feature/xxx -- bun run tsc
2.2 変更状態確認
gwq status
2.3 注意事項
- worktree内で作業を継続する
- コミット・プッシュは通常通り実行可能
- 各Bashコマンドは worktree ディレクトリ内で実行する
3. 作業完了後
3.1 削除前確認
ユーザーに以下を確認する:
- 「worktree作業が完了しました。削除してよろしいですか?」
# 変更状態を確認
gwq status
3.2 削除実行
# 元のリポジトリに移動してから削除
cd <original-repo-path>
# worktree + ブランチを削除(推奨)
gwq remove -b feature/xxx
# worktree のみ削除(ブランチは残す)
gwq remove feature/xxx
3.3 強制削除(未コミット変更がある場合)
ユーザー確認必須:
gwq remove -f feature/xxx
4. トラブルシューティング
不要なworktree参照を削除
gwq prune
全worktree一覧確認
gwq list
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-02-02
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!