Skip to main content
Version: LOC v0.9 (legacy)

Source and Version Control

Synchronising Local and Remote Project

CLI provides several commands for synchronising your local project to or from remote server:

CommandsDescriptionEffect
loc logic buildCompile and upload logicCreate a new logic revision
loc project pullPull remote project (except triggers) to localOverwrite a local project
loc project deployDeploy local project (except triggers) to remoteOverwrite a remote project
loc api ar pullPull remote API routes to localOverwrite local API routes
loc api ar deployDeploy local API routes to remoteOverwrite remote API routes

Upload Logic

Sync Project

Sync API Routes of a Project

Projects and anything in it can be created either in Studio and CLI workspace and to be synced to another.

note

Deleting a remote asset with loc <asset> delete --remote won't delete the local assets; it will only remove the unique ID from local metadata. Likewise, after deleting a local asset, you have to deploy the project or trigger to apply deletion onto the server.

Asset Revisions

Some assets in LOC have revisions:

AssetHave revisions
Logic
Project
Scenario
Data Process
Tag
Unit
Trigger

For these assets, re-deploy a modified version of them (which have different hash values) would create new revisions. All rrevisions of a asset share the same ID in LOC server.

note

CLI does not preserve editing histories for local source files. You can use Git to commit them to a Github repository.

Source Control with Git

Install Git

There are many ways to achieve collaboration with Git, and you can check out Git's official documentation to learn more. Here we'll give you one of the most basic example.

tip

If you are developing with VS Code, you can also use the built-in source control functionalities. See: Using Git source control in VS Code.

Create a .gitignore under your local workspace so unnecessary files/folders will be ignored by Git:

/[local workspace]/.gitignore
.DS_Store
node_modules
loc*
loc*.exe
package-lock.json
pnpm-lock.yaml
yarn.lock

Then create a private Github repo and setup your SSH authentication. Git will prompt you to enter password and SSH passphrase when needed.

Initialise your CLI workspace with Git and commit its contents:

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:<Github account>/<repo name>.git
git push -u origin main

After that, you can push your workspace to the Github repo like this:

git add .
git commit -m "commit description"
git push origin main