ccjk 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +455 -0
- package/README.ko.md +455 -0
- package/README.md +550 -0
- package/README.zh-CN.md +488 -0
- package/bin/ccjk.mjs +2 -0
- package/dist/chunks/api-providers.mjs +89 -0
- package/dist/chunks/claude-code-config-manager.mjs +733 -0
- package/dist/chunks/claude-code-incremental-manager.mjs +603 -0
- package/dist/chunks/codex-config-switch.mjs +427 -0
- package/dist/chunks/codex-provider-manager.mjs +232 -0
- package/dist/chunks/codex-uninstaller.mjs +404 -0
- package/dist/chunks/commands.mjs +120 -0
- package/dist/chunks/features.mjs +642 -0
- package/dist/chunks/simple-config.mjs +10445 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +5972 -0
- package/dist/i18n/locales/en/api.json +63 -0
- package/dist/i18n/locales/en/ccjk.json +276 -0
- package/dist/i18n/locales/en/ccr.json +65 -0
- package/dist/i18n/locales/en/cli.json +57 -0
- package/dist/i18n/locales/en/codex.json +124 -0
- package/dist/i18n/locales/en/cometix.json +29 -0
- package/dist/i18n/locales/en/common.json +20 -0
- package/dist/i18n/locales/en/configuration.json +77 -0
- package/dist/i18n/locales/en/errors.json +26 -0
- package/dist/i18n/locales/en/installation.json +80 -0
- package/dist/i18n/locales/en/interview.json +104 -0
- package/dist/i18n/locales/en/language.json +19 -0
- package/dist/i18n/locales/en/mcp.json +38 -0
- package/dist/i18n/locales/en/menu.json +51 -0
- package/dist/i18n/locales/en/multi-config.json +79 -0
- package/dist/i18n/locales/en/shencha.json +14 -0
- package/dist/i18n/locales/en/team.json +7 -0
- package/dist/i18n/locales/en/tools.json +42 -0
- package/dist/i18n/locales/en/uninstall.json +56 -0
- package/dist/i18n/locales/en/updater.json +25 -0
- package/dist/i18n/locales/en/workflow.json +25 -0
- package/dist/i18n/locales/zh-CN/api.json +63 -0
- package/dist/i18n/locales/zh-CN/ccjk.json +276 -0
- package/dist/i18n/locales/zh-CN/ccr.json +65 -0
- package/dist/i18n/locales/zh-CN/cli.json +57 -0
- package/dist/i18n/locales/zh-CN/codex.json +124 -0
- package/dist/i18n/locales/zh-CN/cometix.json +29 -0
- package/dist/i18n/locales/zh-CN/common.json +20 -0
- package/dist/i18n/locales/zh-CN/configuration.json +77 -0
- package/dist/i18n/locales/zh-CN/errors.json +26 -0
- package/dist/i18n/locales/zh-CN/installation.json +80 -0
- package/dist/i18n/locales/zh-CN/interview.json +104 -0
- package/dist/i18n/locales/zh-CN/language.json +19 -0
- package/dist/i18n/locales/zh-CN/mcp.json +38 -0
- package/dist/i18n/locales/zh-CN/menu.json +51 -0
- package/dist/i18n/locales/zh-CN/multi-config.json +79 -0
- package/dist/i18n/locales/zh-CN/shencha.json +14 -0
- package/dist/i18n/locales/zh-CN/team.json +7 -0
- package/dist/i18n/locales/zh-CN/tools.json +42 -0
- package/dist/i18n/locales/zh-CN/uninstall.json +56 -0
- package/dist/i18n/locales/zh-CN/updater.json +25 -0
- package/dist/i18n/locales/zh-CN/workflow.json +25 -0
- package/dist/index.d.mts +2644 -0
- package/dist/index.d.ts +2644 -0
- package/dist/index.mjs +1706 -0
- package/package.json +157 -0
- package/templates/CLAUDE.md +219 -0
- package/templates/claude-code/CLAUDE.md +250 -0
- package/templates/claude-code/common/settings.json +38 -0
- package/templates/claude-code/en/workflow/bmad/commands/bmad-init.md +165 -0
- package/templates/claude-code/en/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/claude-code/en/workflow/common/agents/init-architect.md +114 -0
- package/templates/claude-code/en/workflow/common/commands/init-project.md +53 -0
- package/templates/claude-code/en/workflow/plan/agents/planner.md +116 -0
- package/templates/claude-code/en/workflow/plan/agents/ui-ux-designer.md +91 -0
- package/templates/claude-code/en/workflow/plan/commands/feat.md +105 -0
- package/templates/claude-code/zh-CN/workflow/bmad/commands/bmad-init.md +172 -0
- package/templates/claude-code/zh-CN/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/claude-code/zh-CN/workflow/common/agents/init-architect.md +114 -0
- package/templates/claude-code/zh-CN/workflow/common/commands/init-project.md +53 -0
- package/templates/claude-code/zh-CN/workflow/plan/agents/planner.md +116 -0
- package/templates/claude-code/zh-CN/workflow/plan/agents/ui-ux-designer.md +91 -0
- package/templates/claude-code/zh-CN/workflow/plan/commands/feat.md +105 -0
- package/templates/codex/common/config.toml +0 -0
- package/templates/common/output-styles/en/casual-friendly.md +97 -0
- package/templates/common/output-styles/en/engineer-professional.md +88 -0
- package/templates/common/output-styles/en/expert-concise.md +93 -0
- package/templates/common/output-styles/en/laowang-engineer.md +127 -0
- package/templates/common/output-styles/en/nekomata-engineer.md +120 -0
- package/templates/common/output-styles/en/ojousama-engineer.md +121 -0
- package/templates/common/output-styles/en/teaching-mode.md +102 -0
- package/templates/common/output-styles/en/technical-precise.md +101 -0
- package/templates/common/output-styles/zh-CN/engineer-professional.md +89 -0
- package/templates/common/output-styles/zh-CN/laowang-engineer.md +127 -0
- package/templates/common/output-styles/zh-CN/nekomata-engineer.md +120 -0
- package/templates/common/output-styles/zh-CN/ojousama-engineer.md +121 -0
- package/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
- package/templates/common/workflow/git/en/git-commit.md +205 -0
- package/templates/common/workflow/git/en/git-rollback.md +90 -0
- package/templates/common/workflow/git/en/git-worktree.md +276 -0
- package/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
- package/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
- package/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
- package/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
- package/templates/common/workflow/interview/en/interview.md +212 -0
- package/templates/common/workflow/interview/zh-CN/interview.md +212 -0
- package/templates/common/workflow/sixStep/en/workflow.md +251 -0
- package/templates/common/workflow/sixStep/zh-CN/workflow.md +215 -0
- package/templates/industry/devops/en/ci-cd-pipeline.md +410 -0
- package/templates/industry/web-dev/en/api-design.md +299 -0
- package/templates/industry/web-dev/en/react-nextjs-setup.md +236 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Safely find and clean up merged or stale Git branches with dry-run mode and custom base/protected branches support
|
|
3
|
+
allowed-tools: Read(**), Exec(git fetch, git config, git branch, git remote, git push, git for-each-ref, git log), Write()
|
|
4
|
+
argument-hint: [--base <branch>] [--stale <days>] [--remote] [--force] [--dry-run] [--yes]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-cleanBranches --dry-run
|
|
7
|
+
# - /git-cleanBranches --base release/v2.1 --stale 90
|
|
8
|
+
# - /git-cleanBranches --remote --yes
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Claude Command: Clean Branches
|
|
12
|
+
|
|
13
|
+
This command **safely** identifies and cleans up **merged** or **stale** Git branches.
|
|
14
|
+
Runs in **read-only preview (`--dry-run`)** mode by default, requiring explicit instructions to perform deletions.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# [Safest] Preview branches to be cleaned without executing any deletions
|
|
22
|
+
/git-cleanBranches --dry-run
|
|
23
|
+
|
|
24
|
+
# Clean local branches merged to main and inactive for over 90 days (requires individual confirmation)
|
|
25
|
+
/git-cleanBranches --stale 90
|
|
26
|
+
|
|
27
|
+
# Clean local and remote branches merged to release/v2.1 (auto-confirm)
|
|
28
|
+
/git-cleanBranches --base release/v2.1 --remote --yes
|
|
29
|
+
|
|
30
|
+
# [Dangerous] Force delete an unmerged local branch
|
|
31
|
+
/git-cleanBranches --force outdated-feature
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Options
|
|
35
|
+
|
|
36
|
+
- `--base <branch>`: Specify the base branch for cleanup (defaults to repository's `main`/`master`).
|
|
37
|
+
- `--stale <days>`: Clean branches with no commits for specified days (disabled by default).
|
|
38
|
+
- `--remote`: Also clean remote merged/stale branches.
|
|
39
|
+
- `--dry-run`: **Default behavior**. Only list branches to be deleted without executing any operations.
|
|
40
|
+
- `--yes`: Skip individual confirmations and delete all identified branches directly (suitable for CI/CD).
|
|
41
|
+
- `--force`: Use `-D` to force delete local branches (even if unmerged).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## What This Command Does
|
|
46
|
+
|
|
47
|
+
1. **Configuration and Safety Checks**
|
|
48
|
+
- **Update Information**: Automatically executes `git fetch --all --prune` to ensure branch status is current.
|
|
49
|
+
- **Read Protected Branches**: Reads the list of branches that should not be cleaned from Git config (see "Configuration" below).
|
|
50
|
+
- **Determine Base**: Uses `--base` parameter or auto-detected `main`/`master` as comparison baseline.
|
|
51
|
+
|
|
52
|
+
2. **Analysis and Identification (Find)**
|
|
53
|
+
- **Merged Branches**: Find local (and remote if `--remote` is added) branches fully merged to `--base`.
|
|
54
|
+
- **Stale Branches**: If `--stale <days>` is specified, find branches with last commit N days ago.
|
|
55
|
+
- **Exclude Protected Branches**: Remove all configured protected branches from cleanup list.
|
|
56
|
+
|
|
57
|
+
3. **Report and Preview (Report)**
|
|
58
|
+
- Clearly list "merged branches to be deleted" and "stale branches to be deleted".
|
|
59
|
+
- Without `--yes` parameter, **command ends here**, waiting for user confirmation to re-execute (without `--dry-run`).
|
|
60
|
+
|
|
61
|
+
4. **Execute Cleanup (Execute)**
|
|
62
|
+
- **Only executed without `--dry-run` and after user confirmation** (or with `--yes`).
|
|
63
|
+
- Delete identified branches one by one, unless user chooses to skip in interactive confirmation.
|
|
64
|
+
- Local: `git branch -d <branch>`; Remote: `git push origin --delete <branch>`.
|
|
65
|
+
- If `--force` is specified, local deletion uses `git branch -D <branch>`.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Configuration (Configure Once, Use Forever)
|
|
70
|
+
|
|
71
|
+
To prevent accidental deletion of important branches (e.g., `develop`, `release/*`), add protection rules to the repository's Git config. The command reads them automatically.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Protect develop branch
|
|
75
|
+
git config --add branch.cleanup.protected develop
|
|
76
|
+
|
|
77
|
+
# Protect all branches starting with release/ (wildcard)
|
|
78
|
+
git config --add branch.cleanup.protected 'release/*'
|
|
79
|
+
|
|
80
|
+
# View all configured protected branches
|
|
81
|
+
git config --get-all branch.cleanup.protected
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Best Practices for Embedded Devs
|
|
87
|
+
|
|
88
|
+
- **Prioritize `--dry-run`**: Develop the habit of previewing before executing.
|
|
89
|
+
- **Leverage `--base`**: When maintaining long-term `release` branches, use it to clean `feature` or `hotfix` branches merged to that release.
|
|
90
|
+
- **Careful with `--force`**: Don't force delete unless you're 100% certain an unmerged branch is useless.
|
|
91
|
+
- **Team Collaboration**: Notify the team channel before cleaning shared remote branches.
|
|
92
|
+
- **Regular Runs**: Run monthly or quarterly to keep the repository clean.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Why This Version Is Better
|
|
97
|
+
|
|
98
|
+
- ✅ **Safer**: Default read-only preview with configurable protected branch list.
|
|
99
|
+
- ✅ **More Flexible**: Supports custom base branches, perfectly fits `release` / `develop` workflows.
|
|
100
|
+
- ✅ **More Compatible**: Avoids commands with inconsistent behavior across systems like `date -d`.
|
|
101
|
+
- ✅ **More Intuitive**: Condenses complex 16-step checklist into a single command with safety options.
|
|
102
|
+
- ✅ **Consistent Style**: Shares similar parameter design and documentation structure with `/commit` command.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze changes with Git only and auto-generate conventional commit messages with optional emoji; suggests splitting commits when needed, runs local Git hooks by default (use --no-verify to skip)
|
|
3
|
+
allowed-tools: Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git rev-parse, git config), Write(.git/COMMIT_EDITMSG)
|
|
4
|
+
argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-commit # Analyze current changes, generate commit message
|
|
7
|
+
# - /git-commit --all # Stage all changes and commit
|
|
8
|
+
# - /git-commit --no-verify # Skip Git hooks
|
|
9
|
+
# - /git-commit --emoji # Include emoji in commit message
|
|
10
|
+
# - /git-commit --scope ui --type feat # Specify scope and type
|
|
11
|
+
# - /git-commit --amend --signoff # Amend last commit with signature
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Claude Command: Commit (Git-only)
|
|
15
|
+
|
|
16
|
+
This command works **without any package manager/build tools**, using only **Git** to:
|
|
17
|
+
|
|
18
|
+
- Read changes (staged/unstaged)
|
|
19
|
+
- Determine if changes should be **split into multiple commits**
|
|
20
|
+
- Generate **Conventional Commits** style messages with optional emoji for each commit
|
|
21
|
+
- Execute `git add` and `git commit` as needed (runs local Git hooks by default; use `--no-verify` to skip)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
/git-commit
|
|
29
|
+
/git-commit --no-verify
|
|
30
|
+
/git-commit --emoji
|
|
31
|
+
/git-commit --all --signoff
|
|
32
|
+
/git-commit --amend
|
|
33
|
+
/git-commit --scope ui --type feat --emoji
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Options
|
|
37
|
+
|
|
38
|
+
- `--no-verify`: Skip local Git hooks (`pre-commit`/`commit-msg` etc.).
|
|
39
|
+
- `--all`: When staging area is empty, automatically `git add -A` to include all changes in the commit.
|
|
40
|
+
- `--amend`: **Amend** the last commit without creating a new one (preserves author and timestamp unless local Git config specifies otherwise).
|
|
41
|
+
- `--signoff`: Add `Signed-off-by` line (use when following DCO process).
|
|
42
|
+
- `--emoji`: Include emoji prefix in commit message (omit for plain text).
|
|
43
|
+
- `--scope <scope>`: Specify commit scope (e.g., `ui`, `docs`, `api`), written to message header.
|
|
44
|
+
- `--type <type>`: Force commit type (e.g., `feat`, `fix`, `docs`), overrides automatic detection.
|
|
45
|
+
|
|
46
|
+
> Note: If the framework doesn't support interactive confirmation, enable `confirm: true` in front-matter to avoid mistakes.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## What This Command Does
|
|
51
|
+
|
|
52
|
+
1. **Repository/Branch Validation**
|
|
53
|
+
- Check if in a Git repository using `git rev-parse --is-inside-work-tree`.
|
|
54
|
+
- Read current branch/HEAD status; if in rebase/merge conflict state, prompt to resolve conflicts first.
|
|
55
|
+
|
|
56
|
+
2. **Change Detection**
|
|
57
|
+
- Get staged and unstaged changes using `git status --porcelain` and `git diff`.
|
|
58
|
+
- If staged files = 0:
|
|
59
|
+
- If `--all` is passed → Execute `git add -A`.
|
|
60
|
+
- Otherwise prompt choice: continue analyzing unstaged changes for **suggestions**, or cancel to manually group staging.
|
|
61
|
+
|
|
62
|
+
3. **Split Suggestions (Split Heuristics)**
|
|
63
|
+
- Cluster by **concerns**, **file modes**, **change types** (e.g., source code vs docs/tests; different directories/packages; additions vs deletions).
|
|
64
|
+
- If **multiple independent changesets** or large diff detected (e.g., > 300 lines / across multiple top-level directories), suggest splitting commits with pathspecs for each group (for subsequent `git add <paths>`).
|
|
65
|
+
|
|
66
|
+
4. **Commit Message Generation (Conventional with Optional Emoji)**
|
|
67
|
+
- Auto-infer `type` (`feat`/`fix`/`docs`/`refactor`/`test`/`chore`/`perf`/`style`/`ci`/`revert`...) and optional `scope`.
|
|
68
|
+
- Generate message header: `[<emoji>] <type>(<scope>)?: <subject>` (first line ≤ 72 chars, imperative mood, emoji included only with `--emoji` flag).
|
|
69
|
+
- Generate message body:
|
|
70
|
+
- Must have a blank line after the subject.
|
|
71
|
+
- Use list format, each item starts with `-`.
|
|
72
|
+
- Each item **must use imperative verb-first sentences** (e.g., "add…", "fix…", "update…").
|
|
73
|
+
- **Colon-separated formats are prohibited** (e.g., ~~"Feature: description"~~, ~~"Impl: content"~~).
|
|
74
|
+
- Describe the motivation, implementation details, or impact scope (3 items or fewer recommended).
|
|
75
|
+
- Generate message footer (if any):
|
|
76
|
+
- Must have a blank line after the Body.
|
|
77
|
+
- **BREAKING CHANGE**: If there are breaking changes, must include `BREAKING CHANGE: <description>`, or add exclamation mark after type (e.g., `feat!:`).
|
|
78
|
+
- Other footers use git trailer format (e.g., `Closes #123`, `Refs: #456`, `Reviewed-by: Name`).
|
|
79
|
+
- Select message language to match the predominant language in Git history. Inspect recent commit subjects (e.g., `git log -n 50 --pretty=%s`) to decide Chinese vs English; if unclear, fall back to the repository's primary locale or English.
|
|
80
|
+
- Write draft to `.git/COMMIT_EDITMSG` for use with `git commit`.
|
|
81
|
+
|
|
82
|
+
5. **Execute Commit**
|
|
83
|
+
- Single commit scenario: `git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG`
|
|
84
|
+
- Multiple commit scenario (if split accepted): Provide clear instructions for `git add <paths> && git commit ...` per group; execute sequentially if allowed.
|
|
85
|
+
|
|
86
|
+
6. **Safe Rollback**
|
|
87
|
+
- If mistakenly staged, use `git restore --staged <paths>` to unstage (command provides instructions, doesn't modify file contents).
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Best Practices for Commits
|
|
92
|
+
|
|
93
|
+
- **Atomic commits**: One commit does one thing, easier to trace and review.
|
|
94
|
+
- **Group before committing**: Split by directory/module/feature.
|
|
95
|
+
- **Clear subject**: First line ≤ 72 chars, imperative mood.
|
|
96
|
+
- **Body with context**: Explain motivation, solution, and impact scope (colon-separated formats prohibited).
|
|
97
|
+
- **Follow Conventional Commits**: `<type>(<scope>): <subject>`.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Type to Emoji Mapping (When --emoji is Used)
|
|
102
|
+
|
|
103
|
+
- ✨ `feat`: New feature
|
|
104
|
+
- 🐛 `fix`: Bug fix (includes 🔥 remove code/files, 🚑️ hotfix, 👽️ adapt to external API changes, 🔒️ security fix, 🚨 fix warnings, 💚 fix CI)
|
|
105
|
+
- 📝 `docs`: Documentation and comments
|
|
106
|
+
- 🎨 `style`: Code style/formatting (no semantic changes)
|
|
107
|
+
- ♻️ `refactor`: Refactoring (no new features, no bug fixes)
|
|
108
|
+
- ⚡️ `perf`: Performance improvements
|
|
109
|
+
- ✅ `test`: Add/fix tests, snapshots
|
|
110
|
+
- 🔧 `chore`: Build/tools/misc tasks (merge branches, update configs, release tags, pin dependencies, .gitignore, etc.)
|
|
111
|
+
- 👷 `ci`: CI/CD configuration and scripts
|
|
112
|
+
- ⏪️ `revert`: Revert commits
|
|
113
|
+
- 💥 `feat`: Breaking changes (explained in `BREAKING CHANGE:` section)
|
|
114
|
+
|
|
115
|
+
> If `--type`/`--scope` is passed, it will **override** auto-detection.
|
|
116
|
+
> Emoji is only included when `--emoji` flag is specified.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Guidelines for Splitting Commits
|
|
121
|
+
|
|
122
|
+
1. **Different concerns**: Unrelated feature/module changes should be split.
|
|
123
|
+
2. **Different types**: Don't mix `feat`, `fix`, `refactor` in the same commit.
|
|
124
|
+
3. **File modes**: Source code vs docs/tests/configs should be grouped separately.
|
|
125
|
+
4. **Size threshold**: Large diffs (e.g., >300 lines or across multiple top-level directories) should be split.
|
|
126
|
+
5. **Revertability**: Ensure each commit can be independently reverted.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Examples
|
|
131
|
+
|
|
132
|
+
**Good (with --emoji)**
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
- ✨ feat(ui): add user authentication flow
|
|
136
|
+
- 🐛 fix(api): handle token refresh race condition
|
|
137
|
+
- 📝 docs: update API usage examples
|
|
138
|
+
- ♻️ refactor(core): extract retry logic into helper
|
|
139
|
+
- ✅ test: add unit tests for rate limiter
|
|
140
|
+
- 🔧 chore: update git hooks and repository settings
|
|
141
|
+
- ⏪️ revert: revert "feat(core): introduce streaming API"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Good (without --emoji)**
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
- feat(ui): add user authentication flow
|
|
148
|
+
- fix(api): handle token refresh race condition
|
|
149
|
+
- docs: update API usage examples
|
|
150
|
+
- refactor(core): extract retry logic into helper
|
|
151
|
+
- test: add unit tests for rate limiter
|
|
152
|
+
- chore: update git hooks and repository settings
|
|
153
|
+
- revert: revert "feat(core): introduce streaming API"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Good (with Body)**
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
feat(auth): add OAuth2 login flow
|
|
160
|
+
|
|
161
|
+
- implement Google and GitHub third-party login
|
|
162
|
+
- add user authorization callback handling
|
|
163
|
+
- improve login state persistence logic
|
|
164
|
+
|
|
165
|
+
Closes #42
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
fix(ui): fix button spacing on mobile devices
|
|
170
|
+
|
|
171
|
+
- adjust button padding to fit small screens
|
|
172
|
+
- fix styling issues on iOS Safari
|
|
173
|
+
- optimize touch target size
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Good (with BREAKING CHANGE)**
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
feat(api)!: redesign authentication API
|
|
180
|
+
|
|
181
|
+
- migrate from session-based to JWT authentication
|
|
182
|
+
- update all endpoint signatures
|
|
183
|
+
- remove deprecated login methods
|
|
184
|
+
|
|
185
|
+
BREAKING CHANGE: authentication API has been completely redesigned, all clients must update their integration
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Split Example**
|
|
189
|
+
|
|
190
|
+
```text
|
|
191
|
+
- `feat(types): add new type defs for payment method`
|
|
192
|
+
- `docs: update API docs for new types`
|
|
193
|
+
- `test: add unit tests for payment types`
|
|
194
|
+
- `fix: address linter warnings in new files` ← (if your repo has hook errors)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Important Notes
|
|
200
|
+
|
|
201
|
+
- **Git only**: No package manager/build commands (`pnpm`/`npm`/`yarn` etc.).
|
|
202
|
+
- **Respects hooks**: Executes local Git hooks by default; use `--no-verify` to skip.
|
|
203
|
+
- **No source code changes**: Command only reads/writes `.git/COMMIT_EDITMSG` and staging area; doesn't directly edit working directory files.
|
|
204
|
+
- **Safety prompts**: In rebase/merge conflicts, detached HEAD states, prompts to handle/confirm before continuing.
|
|
205
|
+
- **Auditable and controllable**: If `confirm: true` is enabled, each actual `git add`/`git commit` step requires confirmation.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactively rollback Git branch to historical version; lists branches, versions, then executes reset/revert after confirmation
|
|
3
|
+
allowed-tools: Read(**), Exec(git fetch, git branch, git tag, git log, git reflog, git checkout, git reset, git revert, git switch), Write()
|
|
4
|
+
argument-hint: [--branch <branch>] [--target <rev>] [--mode reset|revert] [--depth <n>] [--dry-run] [--yes]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-rollback # Full interactive mode, dry-run
|
|
7
|
+
# - /git-rollback --branch dev # Select dev directly, other interactive
|
|
8
|
+
# - /git-rollback --branch dev --target v1.2.0 --mode reset --yes
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Claude Command: Git Rollback
|
|
12
|
+
|
|
13
|
+
**Purpose**: Safely and visually rollback a specified branch to an older version.
|
|
14
|
+
Defaults to **read-only preview (`--dry-run`)**; actual execution requires `--yes` or interactive confirmation.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Pure interactive: list branches → select branch → list recent 20 versions → select target → choose reset or revert → confirm
|
|
22
|
+
/git-rollback
|
|
23
|
+
|
|
24
|
+
# Specify branch, other interactive
|
|
25
|
+
/git-rollback --branch feature/calculator
|
|
26
|
+
|
|
27
|
+
# Specify branch and target commit, execute with hard-reset in one go (dangerous)
|
|
28
|
+
/git-rollback --branch main --target 1a2b3c4d --mode reset --yes
|
|
29
|
+
|
|
30
|
+
# Generate revert commit only (non-destructive rollback), preview
|
|
31
|
+
/git-rollback --branch release/v2.1 --target v2.0.5 --mode revert --dry-run
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Options
|
|
35
|
+
|
|
36
|
+
| Option | Description |
|
|
37
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
38
|
+
| `--branch <branch>` | Branch to rollback; interactively selected if omitted. |
|
|
39
|
+
| `--target <rev>` | Target version (commit hash, tag, or reflog reference); interactively selects recent `--depth` entries if omitted. |
|
|
40
|
+
| `--mode reset\|revert` | `reset`: Hard rollback history; `revert`: Generate reverse commits keeping history intact. Prompts by default. |
|
|
41
|
+
| `--depth <n>` | List recent n versions in interactive mode (default 20). |
|
|
42
|
+
| `--dry-run` | **Enabled by default**, only preview commands to be executed. |
|
|
43
|
+
| `--yes` | Skip all confirmations and execute directly, suitable for CI/CD scripts. |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Interactive Flow
|
|
48
|
+
|
|
49
|
+
1. **Sync remote** → `git fetch --all --prune`
|
|
50
|
+
2. **List branches** → `git branch -a` (local + remote, filter protected branches)
|
|
51
|
+
3. **Select branch** → User input or parameter
|
|
52
|
+
4. **List versions** → `git log --oneline -n <depth>` + `git tag --merged` + `git reflog -n <depth>`
|
|
53
|
+
5. **Select target** → User inputs commit hash / tag
|
|
54
|
+
6. **Select mode** → `reset` or `revert`
|
|
55
|
+
7. **Final confirmation** (unless `--yes`)
|
|
56
|
+
8. **Execute rollback**
|
|
57
|
+
- `reset`: `git switch <branch> && git reset --hard <target>`
|
|
58
|
+
- `revert`: `git switch <branch> && git revert --no-edit <target>..HEAD`
|
|
59
|
+
9. **Push suggestion** → Prompt whether to `git push --force-with-lease` (reset) or regular `git push` (revert)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Safety Guards
|
|
64
|
+
|
|
65
|
+
- **Backup**: Automatically records current HEAD in reflog before execution, recoverable with `git switch -c backup/<timestamp>`.
|
|
66
|
+
- **Protected branches**: If protected branches like `main` / `master` / `production` are detected with `reset` mode enabled, requires additional confirmation.
|
|
67
|
+
- **--dry-run enabled by default**: Prevents accidental operations.
|
|
68
|
+
- **--force prohibited**: No `--force` provided; if force push needed, manually enter `git push --force-with-lease`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Use Case Examples
|
|
73
|
+
|
|
74
|
+
| Scenario | Command Example |
|
|
75
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
76
|
+
| Hotfix patch deployed with bug, need to rollback to tag `v1.2.0` | `/git-rollback --branch release/v1 --target v1.2.0 --mode reset` |
|
|
77
|
+
| Ops colleague pushed debug logs by mistake, need to generate reverse commit | `/git-rollback --branch main --target 3f2e7c9 --mode revert` |
|
|
78
|
+
| Research historical bugs, guide newcomers through branch history | `/git-rollback` (full interactive, dry-run) |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Notes
|
|
83
|
+
|
|
84
|
+
1. **reset vs revert**
|
|
85
|
+
- **reset** changes history, requires force push and may affect other collaborators, use with caution.
|
|
86
|
+
- **revert** is safer, generates new commits preserving history, but adds one more record.
|
|
87
|
+
2. **Embedded repositories** often have large binary files; ensure LFS/submodule state consistency before rollback.
|
|
88
|
+
3. If repository has CI forced validation, rollback may trigger pipelines automatically; confirm control policies to avoid accidental deployment of old versions.
|
|
89
|
+
|
|
90
|
+
---
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Manage Git worktrees in project-level ../.ccjk/project-name/ directory with smart defaults, IDE integration and content migration
|
|
3
|
+
allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp, detect-ide, open-ide, which, command, basename, dirname)
|
|
4
|
+
argument-hint: <add|list|remove|prune|migrate> [path] [-b <branch>] [-o|--open] [--track] [--guess-remote] [--detach] [--checkout] [--lock] [--migrate-from <source-path>] [--migrate-stash]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-worktree add feature-ui # create new branch 'feature-ui' from main/master
|
|
7
|
+
# - /git-worktree add feature-ui -o # create worktree and open directly in IDE
|
|
8
|
+
# - /git-worktree add hotfix -b fix/login -o # create new branch 'fix/login' with path 'hotfix'
|
|
9
|
+
# - /git-worktree migrate feature-ui --from main # migrate uncommitted content from main to feature-ui
|
|
10
|
+
# - /git-worktree migrate feature-ui --stash # migrate current stash to feature-ui
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Claude Command: Git Worktree
|
|
14
|
+
|
|
15
|
+
Manage Git worktrees with smart defaults, IDE integration and content migration in structured `../.ccjk/project-name/` paths.
|
|
16
|
+
|
|
17
|
+
Execute commands directly and provide concise results.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Basic operations
|
|
25
|
+
/git-worktree add <path> # create new branch named <path> from main/master
|
|
26
|
+
/git-worktree add <path> -b <branch> # create new branch with specified name
|
|
27
|
+
/git-worktree add <path> -o # create and open directly in IDE
|
|
28
|
+
/git-worktree list # show all worktree status
|
|
29
|
+
/git-worktree remove <path> # remove specified worktree
|
|
30
|
+
/git-worktree prune # clean invalid worktree references
|
|
31
|
+
|
|
32
|
+
# Content migration
|
|
33
|
+
/git-worktree migrate <target> --from <source> # migrate uncommitted content
|
|
34
|
+
/git-worktree migrate <target> --stash # migrate stash content
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Options
|
|
38
|
+
|
|
39
|
+
| Option | Description |
|
|
40
|
+
| ------------------ | ------------------------------------------------------ |
|
|
41
|
+
| `add [<path>]` | Add new worktree in `../.ccjk/project-name/<path>` |
|
|
42
|
+
| `migrate <target>` | Migrate content to specified worktree |
|
|
43
|
+
| `list` | List all worktrees and their status |
|
|
44
|
+
| `remove <path>` | Remove worktree at specified path |
|
|
45
|
+
| `prune` | Clean invalid worktree references |
|
|
46
|
+
| `-b <branch>` | Create new branch and checkout to worktree |
|
|
47
|
+
| `-o, --open` | Open directly in IDE after creation (skip prompt) |
|
|
48
|
+
| `--from <source>` | Specify migration source path (migrate only) |
|
|
49
|
+
| `--stash` | Migrate current stash content (migrate only) |
|
|
50
|
+
| `--track` | Set new branch to track corresponding remote branch |
|
|
51
|
+
| `--guess-remote` | Auto guess remote branch for tracking |
|
|
52
|
+
| `--detach` | Create detached HEAD worktree |
|
|
53
|
+
| `--checkout` | Checkout immediately after creation (default behavior) |
|
|
54
|
+
| `--lock` | Lock worktree after creation |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What This Command Does
|
|
59
|
+
|
|
60
|
+
1. **Environment Check**
|
|
61
|
+
- Verify Git repository using `git rev-parse --is-inside-work-tree`
|
|
62
|
+
- Detect whether in main repo or existing worktree for smart path calculation
|
|
63
|
+
|
|
64
|
+
2. **Smart Path Management**
|
|
65
|
+
- Auto-calculate project name from main repository path using worktree detection
|
|
66
|
+
- Create worktrees in structured `../.ccjk/project-name/<path>` directory
|
|
67
|
+
- Handle both main repo and worktree execution contexts correctly
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Core path calculation logic for worktree detection
|
|
71
|
+
get_main_repo_path() {
|
|
72
|
+
local git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
73
|
+
local current_toplevel=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
74
|
+
|
|
75
|
+
# Check if in worktree
|
|
76
|
+
if [[ "$git_common_dir" != "$current_toplevel/.git" ]]; then
|
|
77
|
+
# In worktree, derive main repo path from git-common-dir
|
|
78
|
+
dirname "$git_common_dir"
|
|
79
|
+
else
|
|
80
|
+
# In main repository
|
|
81
|
+
echo "$current_toplevel"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
MAIN_REPO_PATH=$(get_main_repo_path)
|
|
86
|
+
PROJECT_NAME=$(basename "$MAIN_REPO_PATH")
|
|
87
|
+
WORKTREE_BASE="$MAIN_REPO_PATH/../.ccjk/$PROJECT_NAME"
|
|
88
|
+
|
|
89
|
+
# Always use absolute path to prevent nesting issues
|
|
90
|
+
ABSOLUTE_WORKTREE_PATH="$WORKTREE_BASE/<path>"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Critical Fix**: Always use absolute paths when creating worktrees from within existing worktrees to prevent path nesting issues like `../.ccjk/project/.ccjk/project/path`.
|
|
94
|
+
|
|
95
|
+
3. **Worktree Operations**
|
|
96
|
+
- **add**: Create new worktree with smart branch/path defaults
|
|
97
|
+
- **list**: Display all worktrees with branches and status
|
|
98
|
+
- **remove**: Safely remove worktree and clean references
|
|
99
|
+
- **prune**: Clean orphaned worktree records
|
|
100
|
+
|
|
101
|
+
4. **Smart Defaults**
|
|
102
|
+
- **Branch creation**: When no `-b` specified, create new branch using path name
|
|
103
|
+
- **Base branch**: New branches created from main/master branch
|
|
104
|
+
- **Path resolution**: Use branch name as path when unspecified
|
|
105
|
+
- **IDE integration**: Auto-detect and prompt for IDE opening
|
|
106
|
+
|
|
107
|
+
5. **Content Migration**
|
|
108
|
+
- Migrate uncommitted changes between worktrees
|
|
109
|
+
- Apply stash content to target worktree
|
|
110
|
+
- Safety checks to prevent conflicts
|
|
111
|
+
|
|
112
|
+
6. **Safety Features**
|
|
113
|
+
- **Path conflict prevention**: Check for existing directories before creation
|
|
114
|
+
- **Branch checkout validation**: Ensure branches aren't already in use
|
|
115
|
+
- **Absolute path enforcement**: Prevent nested `.ccjk` directories when in worktree
|
|
116
|
+
- **Auto-cleanup on removal**: Clean both directory and git references
|
|
117
|
+
- **Clear status reporting**: Display worktree locations and branch status
|
|
118
|
+
|
|
119
|
+
7. **Environment File Handling**
|
|
120
|
+
- **Auto-detection**: Scan `.gitignore` for environment variable file patterns
|
|
121
|
+
- **Smart copying**: Copy `.env` and `.env.*` files that are listed in `.gitignore`
|
|
122
|
+
- **Exclusion logic**: Skip `.env.example` and other template files
|
|
123
|
+
- **Permission preservation**: Maintain original file permissions and timestamps
|
|
124
|
+
- **User feedback**: Provide clear status on copied environment files
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Environment file copying implementation
|
|
128
|
+
copy_environment_files() {
|
|
129
|
+
local main_repo="$MAIN_REPO_PATH"
|
|
130
|
+
local target_worktree="$ABSOLUTE_WORKTREE_PATH"
|
|
131
|
+
local gitignore_file="$main_repo/.gitignore"
|
|
132
|
+
|
|
133
|
+
# Check if .gitignore exists
|
|
134
|
+
if [[ ! -f "$gitignore_file" ]]; then
|
|
135
|
+
return 0
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
local copied_count=0
|
|
139
|
+
|
|
140
|
+
# Detect .env file
|
|
141
|
+
if [[ -f "$main_repo/.env" ]] && grep -q "^\.env$" "$gitignore_file"; then
|
|
142
|
+
cp "$main_repo/.env" "$target_worktree/.env"
|
|
143
|
+
echo "✅ Copied .env"
|
|
144
|
+
((copied_count++))
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
# Detect .env.* pattern files (excluding .env.example)
|
|
148
|
+
for env_file in "$main_repo"/.env.*; do
|
|
149
|
+
if [[ -f "$env_file" ]] && [[ "$(basename "$env_file")" != ".env.example" ]]; then
|
|
150
|
+
local filename=$(basename "$env_file")
|
|
151
|
+
if grep -q "^\.env\.\*$" "$gitignore_file"; then
|
|
152
|
+
cp "$env_file" "$target_worktree/$filename"
|
|
153
|
+
echo "✅ Copied $filename"
|
|
154
|
+
((copied_count++))
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
done
|
|
158
|
+
|
|
159
|
+
if [[ $copied_count -gt 0 ]]; then
|
|
160
|
+
echo "📋 Copied $copied_count environment file(s) from .gitignore"
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Enhanced Features
|
|
168
|
+
|
|
169
|
+
### IDE Integration
|
|
170
|
+
|
|
171
|
+
- **Auto-detection**: VS Code → Cursor → WebStorm → Sublime Text → Vim
|
|
172
|
+
- **Smart prompting**: Ask to open in IDE after worktree creation
|
|
173
|
+
- **Direct open**: Use `-o` flag to skip prompt and open immediately
|
|
174
|
+
- **Custom configuration**: Configurable via git config
|
|
175
|
+
|
|
176
|
+
### Content Migration System
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Migrate uncommitted changes
|
|
180
|
+
/git-worktree migrate feature-ui --from main
|
|
181
|
+
/git-worktree migrate hotfix --from ../other-worktree
|
|
182
|
+
|
|
183
|
+
# Migrate stash content
|
|
184
|
+
/git-worktree migrate feature-ui --stash
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Migration Flow**:
|
|
188
|
+
|
|
189
|
+
1. Verify source has uncommitted content
|
|
190
|
+
2. Ensure target worktree is clean
|
|
191
|
+
3. Show changes to be migrated
|
|
192
|
+
4. Execute safe migration using git commands
|
|
193
|
+
5. Confirm results and suggest next steps
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Examples
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Basic usage
|
|
201
|
+
/git-worktree add feature-ui # create new branch 'feature-ui' from main/master
|
|
202
|
+
/git-worktree add feature-ui -b my-feature # create new branch 'my-feature' with path 'feature-ui'
|
|
203
|
+
/git-worktree add feature-ui -o # create and open in IDE directly
|
|
204
|
+
|
|
205
|
+
# Content migration scenarios
|
|
206
|
+
/git-worktree add feature-ui -b feature/new-ui # create new feature worktree
|
|
207
|
+
/git-worktree migrate feature-ui --from main # migrate uncommitted changes
|
|
208
|
+
/git-worktree migrate hotfix --stash # migrate stash content
|
|
209
|
+
|
|
210
|
+
# Management operations
|
|
211
|
+
/git-worktree list # view all worktrees
|
|
212
|
+
/git-worktree remove feature-ui # remove unneeded worktree
|
|
213
|
+
/git-worktree prune # clean invalid references
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Example Output**:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
✅ Worktree created at ../.ccjk/project-name/feature-ui
|
|
220
|
+
✅ Copied .env
|
|
221
|
+
✅ Copied .env.local
|
|
222
|
+
📋 Copied 2 environment file(s) from .gitignore
|
|
223
|
+
🖥️ Open ../.ccjk/project-name/feature-ui in IDE? [y/n]: y
|
|
224
|
+
🚀 Opening ../.ccjk/project-name/feature-ui in VS Code...
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Directory Structure
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
parent-directory/
|
|
233
|
+
├── your-project/ # main project
|
|
234
|
+
│ ├── .git/
|
|
235
|
+
│ └── src/
|
|
236
|
+
└── .ccjk/ # worktree management
|
|
237
|
+
└── your-project/ # project worktrees
|
|
238
|
+
├── feature-ui/ # feature branch
|
|
239
|
+
├── hotfix/ # hotfix branch
|
|
240
|
+
└── debug/ # debug worktree
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
### IDE Configuration
|
|
248
|
+
|
|
249
|
+
- Supports VS Code, Cursor, WebStorm, Sublime Text, Vim
|
|
250
|
+
- Configurable via git config for custom IDEs
|
|
251
|
+
- Auto-detection with priority-based selection
|
|
252
|
+
|
|
253
|
+
### Custom IDE Setup
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Configure custom IDE
|
|
257
|
+
git config worktree.ide.custom.sublime "subl %s"
|
|
258
|
+
git config worktree.ide.preferred "sublime"
|
|
259
|
+
|
|
260
|
+
# Control auto-detection
|
|
261
|
+
git config worktree.ide.autodetect true # default
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Notes
|
|
267
|
+
|
|
268
|
+
- **Performance**: Worktrees share `.git` directory, saving disk space
|
|
269
|
+
- **Safety**: Path conflict prevention and branch checkout validation
|
|
270
|
+
- **Migration**: Only uncommitted changes; use `git cherry-pick` for commits
|
|
271
|
+
- **IDE requirement**: Command-line tools must be in PATH
|
|
272
|
+
- **Cross-platform**: Supports Windows, macOS, Linux
|
|
273
|
+
- **Environment files**: Automatically copies environment files listed in `.gitignore` to new worktrees
|
|
274
|
+
- **File exclusions**: Template files like `.env.example` are preserved in main repo only
|
|
275
|
+
|
|
276
|
+
---
|