You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,26 @@ wt new feature/deps -i pnpm
30
30
wt new feature/vscode -e code
31
31
```
32
32
33
+
### Create a new worktree with setup scripts
34
+
35
+
```bash
36
+
wt setup <branchName> [options]
37
+
```
38
+
39
+
Creates a new worktree and automatically runs setup commands from `worktrees.json` or `.cursor/worktrees.json`. This is useful for automating dependency installation, copying configuration files, or running custom setup scripts.
40
+
41
+
Options:
42
+
-`-p, --path <path>`: Specify a custom path for the worktree
43
+
-`-c, --checkout`: Create new branch if it doesn't exist and checkout automatically
44
+
-`-i, --install <packageManager>`: Package manager to use for installing dependencies (npm, pnpm, bun, etc.)
45
+
-`-e, --editor <editor>`: Editor to use for opening the worktree (overrides default editor)
46
+
47
+
Example:
48
+
```bash
49
+
wt setup feature/new-feature
50
+
wt setup feature/quick-start -i pnpm
51
+
```
52
+
33
53
### Create a new worktree from Pull Request Number
34
54
35
55
```bash
@@ -77,6 +97,60 @@ wt config path
77
97
78
98
The default editor will be used when creating new worktrees unless overridden with the `-e` flag.
79
99
100
+
### Setup Worktree Configuration
101
+
102
+
You can define setup commands in one of two locations to automatically execute them when using `wt setup`:
103
+
104
+
1.**Cursor's format**: `.cursor/worktrees.json` in the repository root
105
+
2.**Generic format**: `worktrees.json` in the repository root
106
+
107
+
The tool checks for `.cursor/worktrees.json` first, then falls back to `worktrees.json`.
108
+
109
+
**Note:** Setup scripts only run when using the `wt setup` command. The `wt new` command will not execute setup scripts.
110
+
111
+
#### Format Options:
112
+
113
+
**Option 1: `worktrees.json` (recommended for new projects):**
0 commit comments