create-react-app sets master as the default branch but Github has now changed the default branch to be main. So now this package should create the branch name same as that of Github to keep consistency.
(Write your answer here.)
Not needed
6.14.8
(Write your answer here.)
(Write your answer here if relevant.)
System:
OS: Linux 5.8 Manjaro Linux
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 14.8.0 - ~/.nvm/versions/node/v14.8.0/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.8.0/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.3 => 3.4.3
npmGlobalPackages:
create-react-app: 3.4.1
(paste the output of the command here.)
(Write your steps here:)
npx create-react-app test
Default branch name should be main
(Write what you thought would happen.)
Defatul branch name is master
(Write what happened. Please add screenshots!)
(Paste the link to an example project and exact instructions to reproduce the issue.)
I don鈥檛 think that Github鈥檚 decisions should set this library鈥檚 decisions. However, I agree that there鈥檚 a need to update the default branch name to main or at least be able to specify it with a flag.
BTW, If it鈥檚 considered a first good issue, I want to take it 馃槄
Passing a flag seems to be a better option as a person is not restricted to use the default branch. If someone uses GitLab then the default branch in that is master and in Github is main. I think this flag option should be included else it will create a hassle for the users.
Currently, it looks like it respects the git config for init.defaultbranch. I have mine set to main, so when I run yarn create react-app, my branch is main.
A flag would be nice for users to have the option at runtime though.
Let's step into the political domain for a comment... This is not about Github's defaults, it is about why GH changed from m4573r to main.
This is however a Facebook repository, and as such we are all slaves to the master that is Facebook, so it's entirely in keeping for Facebook to keep master in place to remind us of the power it has over our lives.
So, if you're taking a Facebook salary and can't be bothered to prioritise this, then... yeah.. well, you belong there, just keep thinking of the toys we can all buy from the economic slavery that's in place to make them for us ;-)
In other words.
Come on, get with the times.
Let's move at least one part of this injust world forwards... just one.
Please rename master to main
Who's gonna step up to the plate?
If I understand correctly, most of the maintainers here are volunteers.
You could also create a PR to add the functionality. I highly doubt it would be rejected.
If somebody would like to try a PR, here is some information . One of the maintainers could help out once you鈥檝e got a working PR.
Add the new argument somewhere around here.
https://github.com/facebook/create-react-app/blob/d07b7d025f5933710fcb01718617dbdf4bc54c33/packages/create-react-app/createReactApp.js#L74
The variable needs to be passed in here, possibly though some other functions along the way as well.
https://github.com/facebook/create-react-app/blob/d07b7d025f5933710fcb01718617dbdf4bc54c33/packages/create-react-app/createReactApp.js#L508
This function needs to accept the new argument.
https://github.com/facebook/create-react-app/blob/d07b7d025f5933710fcb01718617dbdf4bc54c33/packages/react-scripts/scripts/init.js#L84
I don鈥檛 use git extensively, but I guess the init is where you would pass in the branch name. That is here.
https://github.com/facebook/create-react-app/blob/d07b7d025f5933710fcb01718617dbdf4bc54c33/packages/react-scripts/scripts/init.js#L51
Adding a test to make sure the passed in argument is used would be good #to make sure the functionality isn鈥檛 broken in the future. I didn鈥檛 look at how any test are setup here though, so I don鈥檛 have any info there.
Most helpful comment
I don鈥檛 think that Github鈥檚 decisions should set this library鈥檚 decisions. However, I agree that there鈥檚 a need to update the default branch name to main or at least be able to specify it with a flag.
BTW, If it鈥檚 considered a first good issue, I want to take it 馃槄