# Commit Management

_How Treq creates, splits, and reviews commits inside a workspace._

Treq runs commit operations inside the active workspace. A workspace can contain uncommitted changes, one commit, or a stack of commits above its target. Other workspaces keep their own working copies, so pending changes stay isolated.

You commit and review through the Treq UI. You do not need Jujutsu commands for this flow.

## Workspace Scope

The file tree, diff viewer, commit history, and review tools all read from the selected workspace path. Each workspace has an independent working copy.

## Git and Jujutsu

Treq opens a Git repository and places [Jujutsu](https://jj-vcs.github.io/jj/latest/) beside it in colocated mode. Commits you create in the UI are Git-compatible revisions. They appear in `git log` and travel through normal Git remotes when you push.

Jujutsu supplies the revision operations Treq uses for commits, splits, and stack updates. Treq runs those operations for you. You do not need `jj` commands to commit from the app.

Treq does not expose a Git staging index. File selection in the commit form maps to a Jujutsu split when you commit selected files only. Unselected changes stay in the working copy.

You can still run `git` in a workspace terminal. Those commands see the same object store Treq writes to. Mixing manual Git or `jj` commands with Treq in the same workspace is possible but harder to reason about. Prefer Treq for commits and stack updates. Reserve the `jj` CLI for intentional debugging.

When a target branch moves, Treq rebases dependent workspace commits through Jujutsu. See [Workspaces](/docs/concepts/workspaces) for stack and rebase behavior.

## Commit Creation

The commit form requires a message of no more than 500 characters. If you selected files, Treq commits those files through a split operation. If you selected no files, Treq commits every pending change in the working copy.

File selection lets you divide a large agent change into reviewable commits. Select files that belong to one logical change, commit them, then repeat with the files left behind.

## Commit History

Treq shows commits relative to the workspace target. This makes the current stack visible without requiring you to inspect bookmarks or revisions from the command line. The history separates committed work from pending file changes.

## Commit-Level Diff

Treq can show the diff for one commit instead of the cumulative workspace changes above the target. Use this when a stack is easier to inspect one revision at a time.

Selecting a commit changes the visible diff in the review interface. Comments attach to files and line ranges in that view.

Conflict state belongs to the workspace, not a single commit. A commit view can explain where a conflicting change came from, while the workspace diff shows the conflict that must be resolved.

## Manipulation Model

Commit operations update the workspace history. Treq then refreshes derived state such as changed files, divergence from the target, and the visible review diff.

| Operation | Purpose | Workspace effect |
|---|---|---|
| Create commit | Save selected changes with a message | Adds a new commit above the workspace target |
| Split changes | Commit selected files | Leaves unselected files in the working copy |
| Merge workspace | Integrate workspace commits into the target | Moves completed work out of the workspace flow |

## Safety Boundaries

Discarding a change modifies the working copy. Deselecting a file only removes it from the next partial commit. Treq also keeps workspace integration separate from commit creation, so creating a commit never merges the workspace into its target.

Pending changes can prevent Treq from synchronizing a working copy after a rebase. Commit, move, or discard those changes before rewriting a workspace stack.

## Learn More

- [Committing Changes](/docs/tutorials/committing-changes)
- [Code Review Workflow](/docs/tutorials/code-review-workflow)
- [Changes and Reviews](/docs/concepts/changes-and-reviews)
- [Workspaces](/docs/concepts/workspaces)
- [Under the Hood](/docs/under-the-hood)
