Skip to content

fix(create): initialize git once for new monorepos - #2417

Draft
jong-kyung wants to merge 1 commit into
voidzero-dev:mainfrom
jong-kyung:fix/create-monorepo-double-git-init
Draft

fix(create): initialize git once for new monorepos#2417
jong-kyung wants to merge 1 commit into
voidzero-dev:mainfrom
jong-kyung:fix/create-monorepo-double-git-init

Conversation

@jong-kyung

Copy link
Copy Markdown
Collaborator

Description

Creating a new monorepo with vp create vite:monorepo handled git initialization through two separate code paths, which caused three related problems:

  • In verbose interactive mode without --git/--no-git, the user was prompted twice ("Initialize a git repository?" from resolveGitInit, then "Initialize git repository:" inside the monorepo branch).
  • When the two answers differed, the second answer was silently overridden because the later initGitRepository call keyed off the first prompt's result.
  • On the common (compact) path, git init ran twice: once via a direct spawn.sync right after scaffolding and again via initGitRepository after the monorepo rewrite.

Fix

  • Remove the duplicate prompt; resolveGitInit already asks up front before scaffolding.
  • Keep a single initGitRepository call, placed before the hook preflight so shouldSkipStagedMigrationForHooks sees the destination's intended git root (same reasoning as the standalone path).
  • Move the failure warning and stderr output into the shared initGitRepository helper so both the monorepo and standalone paths report a failed git init.

Creating a new monorepo prompted for git initialization twice in
verbose interactive mode and ran `git init` twice on the common path:
once through a direct spawn right after scaffolding and again through
`initGitRepository` after the monorepo rewrite. The second run also
used the first prompt's answer, so answering no to the second prompt
was silently overridden.

Remove the duplicate prompt and keep a single `initGitRepository` call
placed before the hook preflight, matching the standalone path, and
move the failure warning into the shared helper so both paths report
a failed `git init`.
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit b880b19
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a7b30821e950e00087d59a5

@jong-kyung jong-kyung self-assigned this Aug 11, 2026
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: b880b1933b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant