From 04ab1b6d9b1ed8efaa15c2671822093dcf5e9276 Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 25 Nov 2024 11:31:46 -0700 Subject: [PATCH 1/3] fix: modus new rename branch to main if not --- cli/src/commands/new/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/src/commands/new/index.ts b/cli/src/commands/new/index.ts index 36b325c3..ef70b009 100644 --- a/cli/src/commands/new/index.ts +++ b/cli/src/commands/new/index.ts @@ -333,6 +333,13 @@ export default class NewCommand extends BaseCommand { if (createGitRepo) { await execFile("git", ["init"], execOpts); + + // If branch name is not `main`, rename it to `main` + const { stdout: currentBranch } = await execFile("git", ["symbolic-ref", "--short", "HEAD"], execOpts); + if (currentBranch.trim() !== "main") { + await execFile("git", ["branch", "-m", "main"], execOpts); + } + await execFile("git", ["add", "."], execOpts); await execFile("git", ["commit", "-m", "'Initial Commit'"], execOpts); } From 72de5fed42c0278b6a56a93b6b226caccae84af8 Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 25 Nov 2024 11:34:42 -0700 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3cbbad..afc679db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## Unreleased + +- fix: modus new rename branch to main if not [#613](https://github.com/hypermodeinc/modus/pull/613) + ## 2024-11-23 - Runtime 0.14.0 - feat: Apply in-code documentation to generated GraphQL [#519](https://github.com/hypermodeinc/modus/pull/519) From 5ce9941749d8ebb693d9e4d333c69c6c17a4bced Mon Sep 17 00:00:00 2001 From: Pine Date: Mon, 25 Nov 2024 12:02:17 -0700 Subject: [PATCH 3/3] address feedback --- cli/src/commands/new/index.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cli/src/commands/new/index.ts b/cli/src/commands/new/index.ts index 95f750b3..fa817526 100644 --- a/cli/src/commands/new/index.ts +++ b/cli/src/commands/new/index.ts @@ -332,14 +332,7 @@ export default class NewCommand extends BaseCommand { } if (createGitRepo) { - await execFile("git", ["init"], execOpts); - - // If branch name is not `main`, rename it to `main` - const { stdout: currentBranch } = await execFile("git", ["symbolic-ref", "--short", "HEAD"], execOpts); - if (currentBranch.trim() !== "main") { - await execFile("git", ["branch", "-m", "main"], execOpts); - } - + await execFile("git", ["init", "-b", "main"], execOpts); await execFile("git", ["add", "."], execOpts); await execFile("git", ["commit", "-m", `"Initial Commit"`], execOpts); }