Skip to main content
Version: LOC v0.8 (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 initInitialise a CLI workspace (with the option to pull all remote projects to local)Overwrite all local projects and local logic metadata
loc project pullPull remote project to localOverwrite a local project
loc project deployDeploy local project to remoteOverwrite a remote project

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

note

Delete a remote project with loc project delete --remote won't apply to the local project.

Initialise a workspace will also delete all the local logic metadata (not source files), despite they have been deployed to the LOC server. You can add them back to .loc/logic-manifest.yaml with loc logic create using the existing logic name.

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