Package Exports
- git-worktree-cli
- git-worktree-cli/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (git-worktree-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Git Worktree Manager (mktree)
Claude Codeでの並列開発をサポートするGit Worktree管理ツール。
概要
- プライマリ: ソースディレクトリにあるメインブランチ
- Worktree:
.git/worktrees/に作成される作業ブランチ - プライマリとWorktreeを自由に切り替え可能
- ローカル環境での動作確認も維持
インストール
# プロジェクトルートでインストール
cd git-worktree-manager
npm install使用方法
基本コマンド
# Worktree一覧表示
npx mktree list
# 新しいWorktreeを作成
npx mktree add feature-123
# Worktreeの存在確認
npx mktree check-exist feature-123
# Worktreeを削除
npx mktree remove feature-123
# Worktreeに切り替え
npx mktree switch feature-123高度な操作
# WorktreeをプライマリにMx
npx mktree stage-primary feature-123
# リモートから同期(全Worktree)
npx mktree remote-sync
# 特定のWorktreeのみ同期
npx mktree remote-sync feature-123
# Worktreeをリネーム
npx mktree rename old-feature new-featureブランチ管理
# 新しいブランチをプライマリに設定(現在のブランチをWorktreeに移動)
npx mktree apply-primary feature-456
# 新しいブランチをプライマリに設定(Worktree作成をスキップ)
npx mktree overwrite-primary feature-456
# ヘルプ表示
npx mktree help主要機能
stage-primary の動作
- プライマリに未コミットの変更があればstash
- 現在のプライマリブランチがmain/master/develop以外の場合、Worktreeに移動
- 指定されたWorktreeのブランチをプライマリに切り替え
- 元のWorktreeを削除
- stashした変更があれば復元
remote-sync の動作
- 引数なし: 全てのWorktreeでgit pullを実行
- 引数あり: 指定されたWorktreeのみgit pullを実行
注意事項
- Worktreeは必ず
.git/worktrees/に作成される - プライマリWorktreeは削除・リネーム不可
- Git repository内でのみ動作
使用例
# 新機能開発の開始
npx mktree add feature-chat-improvement
# 別の緊急対応
npx mktree add hotfix-login-bug
# 緊急対応をプライマリに持ってきて動作確認
npx mktree stage-primary hotfix-login-bug
# 修正完了後、元の機能開発に戻る
npx mktree stage-primary feature-chat-improvementディレクトリ構成
git-worktree-manager/
├── index.js # メインスクリプト
├── package.json # NPM設定
└── README.md # このファイル