Unverified Commit 19febb10 authored by Dinesh Balaji's avatar Dinesh Balaji Committed by GitHub

feat: update create-next-app to init with main as initial branch (#17745)

When `create-next-app` is initialized a git repo, it now uses 'main' as the initial branch.

The branch master does not actually exist initially. The branches don't get created only when they have at least one commit. Until the branch gets created, the branch only exists in .git/HEAD. So there is no master branch initialized in the repo.

Closes: https://github.com/vercel/next.js/issues/17733

<img width="639" alt="Screenshot 2020-10-09 at 17 26 30" src="https://user-images.githubusercontent.com/4656109/95580229-9f3c6c80-0a54-11eb-967f-180eb9601c1a.png">
parent 266c7ed7
...@@ -30,6 +30,8 @@ export function tryGitInit(root: string): boolean { ...@@ -30,6 +30,8 @@ export function tryGitInit(root: string): boolean {
execSync('git init', { stdio: 'ignore' }) execSync('git init', { stdio: 'ignore' })
didInit = true didInit = true
execSync('git checkout -b main', { stdio: 'ignore' })
execSync('git add -A', { stdio: 'ignore' }) execSync('git add -A', { stdio: 'ignore' })
execSync('git commit -m "Initial commit from Create Next App"', { execSync('git commit -m "Initial commit from Create Next App"', {
stdio: 'ignore', stdio: 'ignore',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment