Auto-switch to newly crated branch

This commit is contained in:
DanConwayDev authored and Alex Gleason committed 2025-11-13 16:22:50 -06:00
1 parent 21e522cba7
commit 43f4e0d15d
2 files changed
+26 -6

No files matched your search

+13 -3
View File
@@ -243,13 +243,23 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
object: currentRef,
});
toast({
title: 'Branch created',
description: `Created branch "${newBranchName}"`,
// Automatically check out the new branch
await git.checkout({
dir: projectPath,
ref: newBranchName.trim(),
force: true,
});
// Close the dialog before showing the toast
setNewBranchName('');
setIsCreateBranchDialogOpen(false);
// Show success toast indicating the branch was created and checked out
toast({
title: 'Branch created and checked out',
description: `Switched to new branch "${newBranchName.trim()}"`,
});
await loadBranches();
await refetchGitStatus();
} catch (error) {
+13 -3
View File
@@ -187,13 +187,23 @@ export function BranchManager({ projectId, currentBranch, onBranchChange }: Bran
object: currentRef,
});
toast({
title: 'Branch created',
description: `Created branch "${newBranchName}"`,
// Automatically check out the new branch
await git.checkout({
dir: projectPath,
ref: newBranchName.trim(),
force: true,
});
// Close the dialog before showing the toast
setNewBranchName('');
setIsCreateDialogOpen(false);
// Show success toast indicating the branch was created and checked out
toast({
title: 'Branch created and checked out',
description: `Switched to new branch "${newBranchName.trim()}"`,
});
await loadBranches();
onBranchChange?.();
} catch (error) {