feat(worktree): add start point option for new branch creation

Allow selecting a base branch when creating new worktree branches
Add dropdown to choose start point from existing branches
Extend worktree creation flow to support custom branch origins
This commit is contained in:
Bohdan Triapitsyn
2026-01-01 13:39:55 +02:00
parent 39b9f985ce
commit 5a71e050a5
8 changed files with 326 additions and 48 deletions
+3 -1
View File
@@ -59,6 +59,7 @@ export interface CreateWorktreeOptions {
worktreeSlug: string;
branch: string;
createBranch?: boolean;
startPoint?: string;
}
export interface RemoveWorktreeOptions {
@@ -84,7 +85,7 @@ export async function resolveWorktreePath(projectDirectory: string, worktreeSlug
}
export async function createWorktree(options: CreateWorktreeOptions): Promise<WorktreeMetadata> {
const { projectDirectory, worktreeSlug, branch, createBranch } = options;
const { projectDirectory, worktreeSlug, branch, createBranch, startPoint } = options;
const normalizedProject = normalize(projectDirectory);
const worktreePath = await resolveWorktreePath(normalizedProject, worktreeSlug);
@@ -92,6 +93,7 @@ export async function createWorktree(options: CreateWorktreeOptions): Promise<Wo
path: worktreePath,
branch,
createBranch: Boolean(createBranch),
startPoint: startPoint?.trim() || undefined,
};
await addGitWorktree(normalizedProject, payload);