Repository & workflow setup
CodeSandbox has an opinionated flow when it comes to working with repositories, and you can see hints of this in the editor.
As soon as you enter the editor, you will see the current branch name in the header. Every branch has its own VM and is available through a unique URL. For example, if two people visit the URL for the
main branch, they will be able to see each other's cursor, terminals and DevTools.
On CodeSandbox, the
main branch is protected by default. This means that it's read-only and will sync automatically with the branch on GitHub when new commits come in.
To write some code, you have three options:
- (Recommended) Just start typing some code - we will create a new branch for you using seamless branching!
- Click the “Branch” button in the header.
- Toggle protection off for the
When we create the new branch, we create a clone of the
main VM and switch it to the new branch. This new VM is an exact copy of the original VM, down to the memory contents. Because of this, processes like dev servers are already started in the cloned VM.
mainbranch, seed some data in it, and then every new branch created from
mainwill have that data available.