Create a feature branch in a new git worktree, as a sibling directory of the current project.
Steps
-
Take the branch name from the argument. If none provided, ask the user — never generate a name.
-
Fetch the latest main:
git fetch origin main
-
Create the worktree:
git worktree add ../<branch-name> -b <branch-name> origin/main- This creates
../<branch-name>/alongside the current project directory
-
Confirm to the user:
- Show the branch name
- Show the worktree path