# Plastic SCM / cm Command Workflow

This manual explains a basic command-line workflow for Plastic SCM using `cm`.

Use this when working with version control from the terminal.

## Main Rule

Before changing files:

```text
Check status.
Understand what is already changed.
Do not overwrite teammate work.
```

## Common Commands

Check workspace status:

```bash
cm status
```

Update workspace:

```bash
cm update
```

See file differences:

```bash
cm diff path/to/file
```

Add new files:

```bash
cm add path/to/file
```

Add a new folder recursively:

```bash
cm add path/to/folder -R
```

Commit/check in changes:

```bash
cm checkin -c "your message"
```

Short form may also be available:

```bash
cm ci -c "your message"
```

## Recommended Daily Workflow

Start work:

```bash
cm status
cm update
cm status
```

Make changes in Unity or code editor.

Before commit:

```bash
cm status
cm diff
```

Add new files if needed:

```bash
cm add Assets/Docs/03_Project_Folder_Structure.md
```

Commit:

```bash
cm checkin -c "docs: add project folder structure manual"
```

## Commit Message Style

Use clear messages.

Recommended format:

```text
type: short description
```

Examples:

```text
feat: add fire camp checkpoint interaction
fix: prevent wizard from flipping during attack
docs: add Unity mental model manual
chore: organize environment prefabs
```

Avoid:

```text
update
fix
things
final
final final
```

## Unity Files To Include

When adding Unity assets, include both asset and `.meta` file.

Example:

```text
Assets/Prefabs/Characters/NewEnemy.prefab
Assets/Prefabs/Characters/NewEnemy.prefab.meta
```

Why:

```text
.meta files store Unity GUIDs.
Broken or missing .meta files can break references.
```

## Before Checkin Checklist

```text
cm status reviewed
New files added with cm add
No accidental temporary files
No broken scenes
No missing scripts
No Console errors from your change
Prefab changes saved
Scene changes intentional
Commit message is clear
```

## Handling New Files

If `cm status` shows private files, they are not yet tracked.

Add only files that should be versioned.

Good to add:

```text
.cs
.prefab
.unity
.anim
.controller
.asset
.md
.png
.meta
```

Usually do not add:

```text
Library
Temp
Obj
Build
UserSettings
Logs
```

Unity generated cache folders should not be versioned.

## Avoiding Accidental Reverts

Do not undo files you do not understand.

Before undoing:

```bash
cm diff path/to/file
```

If the file contains teammate work, ask first.

## Working With Unity Scenes

Unity scenes can conflict when multiple people edit the same scene.

Safer workflow:

```text
Communicate before editing the same scene.
Keep scene changes focused.
Prefer prefab changes for reusable setup.
Avoid unnecessary scene saves.
```

## Conflict Advice

If Plastic reports conflicts:

```text
Stop.
Do not randomly choose yours/theirs.
Identify which files conflict.
Ask the owner if unsure.
Resolve carefully in Unity-aware way.
```

For `.unity`, `.prefab`, `.controller`, and `.anim` files, conflicts can be difficult because they are serialized YAML. Do not manually merge them unless you understand the file.

## Useful Review Pattern

Before committing, review changed files:

```bash
cm status
cm diff Assets/Scripts/Player/RikaPlayerController.cs
cm diff Assets/Prefabs/Characters/Rika.prefab
```

For docs:

```bash
cm diff Assets/Docs/13_Plastic_SCM_cm_Command_Workflow.md
```

## Summary

Basic workflow:

```text
cm status
cm update
make changes
cm status
cm diff
cm add new files
cm checkin -c "clear message"
```

Always include Unity `.meta` files for new assets.
