Builder CLI's pull and push commands sync your local environment with Builder's remote environment. These commands enable developers to use local coding tools alongside Builder's powerful interactive Visual Editor.
Complete the following steps in preparation for using the pull and push commands:
- Create a Project connected to a repository. This can be done by following the instructions within Projects from repositories.
- Create a new branch on Builder within your Project. For more details, visit Create and duplicate branches.
- Go to the Code tab within your Build Project branch.
- At the bottom of the file system, click the Push to Remote button. This creates a new branch within your remote repository, connected to your Project's branch.
The video below demonstrates where to find the Push to Remote button. Note that the Push to Remote button is only active on a Project branch once changes have been made.
The Push to Remote button needs to be pushed only once per branch.
To sync Visual Editor changes to your local machine:
- Ensure you have the Project repository already cloned on your local machine.
- Navigate to the directory where your repository is located.
- Run the following command:
# Mac and Linux
npx builder.io@latest pull <BRANCH-ID>On Windows, use npx "@builder.io/dev-tools@latest" pull <BRANCH-ID>.
These commands can be found within the Code tab of the Visual Editor, at the bottom of the file section.
Alternatively, find the branch ID within the URL.
https://builder.io/app/projects/:projectId/:branchIdWhen you run this command:
- A new branch is created on your local machine, if necessary
- Code changes made within the Visual Editor are copied to the local version of your code
The following arguments can also be optionally passed to the command:
| Flag | Description |
|---|---|
| Overrides the configured Project with the given Project ID. |
| Use this flag to see how the command would run without making any changes. |
To sync local changes to your Builder Project:
- Navigate to the directory where your repository is located.
- Make changes to the related repository on your local machine.
- Run the following command:
# Mac and Linux
npx builder.io@latest pushOn Windows, use npx "@builder.io/dev-tools@latest" push.
This command:
- Pushes local code changes to the branch within your remote repository
- Syncs local code changes with your Builder Project's branch
Note: Only your committed changes are synced. If you do not see changes within Builder, confirm your local changes have been committed.
The following arguments can also be optionally passed to the command:
| Flag | Description |
|---|---|
| Overrides the configured Project with the given Project ID. |
| Use this flag to find out how the command would run without making any changes. |