---
name: ccd-git-workflow
description: Use when a Git-backed project workspace needs branch/worktree isolation or commit/push/merge follow-through around the CCD session loop
---

# CCD Git Workflow

Git-backed workflow helper. Use it after startup continuity is already loaded, typically by the shipped runtime lifecycle path and otherwise by `/ccd-start` or `ccd start --activate --path .`, or after `/ccd-radar` when you need Git follow-through on the resulting changes.

## Gotchas

- **Shared safety contract:** inspect before mutation, show the full diff before commit, keep CCD machine-readable stdout clean, and require explicit approval before destructive or publishing Git actions.
- **Git-backed only:** do not use this skill for directory substrates. Those stay on the shipped runtime lifecycle path when available, otherwise on `ccd start --activate`, plus `ccd session-state clear` in the current checkout.
- **`ccd session open` is Git-only:** it creates or reuses a Git worktree and requires explicit `--branch`. There is no non-Git equivalent yet.
- **CCD telemetry stays CCD-owned:** `ccd-start` owns `session-state start` in the current checkout, and `ccd session open` already runs it in isolated worktrees. Do not replace CCD telemetry with ad-hoc Git notes.
- **Explicit staging remains the rule:** show the diff first, stage only approved paths, and never use `git add .`.

## Prepare

1. Resolve the CLI command exactly as the kernel skills do: `CCD_BIN`, `ccd` from `PATH`, `$HOME/.ccd/bin/ccd`, then `$HOME/.cargo/bin/ccd`.
2. Run `git rev-parse --is-inside-work-tree`.
3. If the checkout is not inside a Git work tree, stop and fall back to the substrate-neutral `ccd-start` / `ccd-radar` flow.
4. If continuity has not been loaded yet, let the runtime lifecycle bootstrap run first. If the current runtime has no lifecycle integration or you are on manual Codex startup, run `ccd start --activate --path .` or `/ccd-start` first. This skill assumes continuity is already loaded.

## Start On The Current Checkout

Use this when the developer wants a normal session branch in the current checkout.

1. If the current branch is `main`, `master`, or `develop`, run:
   ```bash
   git checkout -b session/<name> || git checkout session/<name>
   ```
2. If already on a non-protected branch, continue there instead of forcing a new branch.
3. Report the branch you are continuing on.
4. Do not rerun `session-state start` here. The runtime lifecycle bootstrap or raw `ccd-start` fallback already owns session bootstrap in the current checkout.

## Open An Isolated Worktree

Use this only when the developer wants a separate Git worktree/profile pair.

```bash
ccd session open --path . \
  --profile <profile> \
  --worktree ../<checkout-name> \
  --branch session/<name> \
  --from <parent-branch>
```

- Keep the `--branch` explicit.
- Treat `ccd session open` as Git-backed only.
- Remember that one Git branch can only be checked out in one worktree at a time.

## After `/ccd-radar`

Use normal Git workflow after Radar has updated CCD-owned planning state.

1. Summarize the pending tree with `git status --short --branch` and `git diff --minimal --stat`.
2. Before any commit, show the full `git diff --minimal` for the approved paths.
3. Stage only the approved paths with explicit `git add <path>...`.
4. Commit with a message that matches the delivered change.
5. Push only when approved, typically with `git push -u origin <branch>`.
6. Open or update the PR with the repo's normal forge tooling.
7. Merge only after review feedback is addressed and CI is green.
