Create a new git worktree with environment files copied
Creates a new git worktree with environment files copied from main repository.
/plugin marketplace add notedit/happy-coding-agent/plugin install notedit-happy-coding-agent@notedit/happy-coding-agentBranch name or new branch name (e.g., "feature/new-feature")git/Create a new worktree and copy essential environment files.
Parse $ARGUMENTS:
Check:
git worktree list - show existing worktreesDefault path: ../<repo-name>-<branch-name>
Example:
my-project, Branch: feature/login../my-project-feature-loginAsk user to confirm or customize path.
If branch exists:
git worktree add <path> <branch>
If new branch:
git worktree add -b <branch> <path>
Files to copy (if they exist in main worktree):
| File | Description |
|---|---|
| .env | Environment variables |
| .env.local | Local environment |
| .env.development | Development config |
| .env.development.local | Local dev config |
| .env.test | Test config |
| .env.production.local | Local prod config |
| .envrc | direnv config |
Copy command:
for f in .env .env.local .env.development .env.development.local .env.test .env.production.local .envrc; do
[ -f "$f" ] && cp "$f" "<worktree-path>/"
done
Additional files (ask user):
.npmrc / .yarnrc - Package manager configconfig/local.json - Local config filesActions:
cd <worktree-path>git worktree list to see all worktrees| Situation | Action |
|---|---|
| Branch already checked out | Suggest using existing worktree |
| Path exists | Ask to remove or use different path |
| Uncommitted changes | Warn user, suggest stash |