Plastic SCM command line cheat sheet

Updated to Plastic SCM 4.0

First steps: creating a new repository and workspace

To get a list of all the available commands, type:

cm

To get an usage description of a specific command, type:

cm <command> -h
cm <command> --help

Create a new repository:

cm mkrep newRepositoryName@myPlasticServer:8084

Create a workspace:

cm mkwk newWorkspaceName /myworkspace

Set workspace to the main branch of another repository (cd to the workspace directory)

cm stb /main@theRepositoryName

Adding your sources to the repository

Adding all the files in the root of the workspace recursively:

cm add -R *
cm ci

Populating your workspace

Get the latest changes in the repository (run from any directory inside the workspace):

cm update .

Changing files and storing new versions in the repository

To edit a file:

cm co fileToEdit.cpp

To get a list of the items that have been edited in the workspace:

cm status

To store a new version of a changed file in the repository (Check In):

cm ci checkedOutFile.cpp

To check in all pending changes with a comment:

cm ci -c="comment about the changes"

To check in a file specifying a comment:

cm ci file.cpp -c="with comment"

Note: You don't need to check out a file to edit it, just modify it, and you can then check it in. See the no-checkout workflow article for more details.

Creating a new child branch

Create the branch with base on the current changeset loaded in the workspace:

cm mkbr /main/childbranch

Creating the branch with base on changeset number 12:

cm mkbr /main/childbranch --changeset=12

Switch the workspace to work on that branch:

cm stb /main/childbranch

List all the branches in the current repository:

cm find branches

List all the branches created by me on another repository:

cm find branches where owner = 'ME' on repository 'anotherRep'

Merging the changes on the child branch with the parent branch

First: switch the workspace to the parent branch (merge always takes the changes from a branch/label to the current content of the workspace)

cm stb /main

Preview the items to be merged from the branch:

cm merge /main/childbranch

Now perform the actual merge operation:

cm merge /main/branch --merge

To get a list of the changed items result of the merge:

cm status

To check in all the merged items:

cm ci -c="merged childbranch"

Applying a label

Create a label and apply it to the changeset currently loaded in the workspace:

cm mklb myNewLabel

Create a label and apply it on changeset number 19

cm label myNewLabel --changeset=19

Replication

Push mybranch to another server:

cm replicate mybranch@localRep remoteRep@remoteServer:8084

Pull remote branch from a remote server to my local server

cm replicate remoteBranch@remoteRep@remoteServer:8084 localRep@localServer:8084