add branch logic mcp tool

This commit is contained in:
Shawn Morreau
2025-12-10 13:13:26 -05:00
parent ccb28d8cf5
commit 994d493e08
2 changed files with 5 additions and 6 deletions
+3 -2
View File
@@ -30,8 +30,9 @@ export const CreateBranchTool = tool({
// fetch base branch to ensure we're up to date
$("git", ["fetch", "origin", baseBranch, "--depth=1"]);
// checkout base branch
$("git", ["checkout", baseBranch]);
// checkout base branch, ensuring it matches the remote version
// -B creates or resets the branch to match origin/baseBranch
$("git", ["checkout", "-B", baseBranch, `origin/${baseBranch}`]);
// create and checkout new branch
$("git", ["checkout", "-b", branchName]);