Here are steps to create Scratch org using SFDX CLI Commands.
- Open Visual Studio IDE , go to Terminal and execute the below sfdx CLI commands.
Note: sfdx cli installation should be done.
2. Connect to the DevHub Org using the below command
sfdx force:auth:web:login -d -a devHub
Login with Username / Password
After successfully connected to DevHub Org
3. Create a salesforce project in the VS Code using the below command
Cmd + Shift + P
Create a Project with manifest
Enter the Project name
sfdx force:org:create -f config/project-scratch-def.json -a demoorg1
Once the project created successfully, will able to see the below message
Successfully created scratch org: 00D0x0000009IeHEAU, username: firstname.lastname@example.org
4. Verify to which org, you are connected using below command
sfdx force:org:display -u
To see the list of orgs connected, execute the below command
5. To retrieve the metadata
sfdx force:source:retrieve -u -p force-app
6. Verify the source code folder force-app
Keep watching this space for more updates
Have a nice day 🙂