# Version history

> Browse past versions, inspect content changes, and restore a selected version to the shared document.

- Human documentation: [https://docs.univer.ai/overview/features/shared/history](https://docs.univer.ai/overview/features/shared/history)

- Agent Markdown: [https://docs.univer.ai/overview/features/shared/history.md](https://docs.univer.ai/overview/features/shared/history.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.3.0`

- Source: [features/shared/history.mdx](https://github.com/dream-num/documentation/blob/dev/content/docs/features/shared/history.mdx)

---

Version history organizes confirmed collaborative changes into browsable versions. Developers and users can inspect authors, timestamps, and actions, open historical content, review changes, and restore a version when permitted. History remains available across editing sessions and page reloads.

## How version history works

- **Mutation**: A replayable content change, such as setting a cell or inserting a paragraph.
- **Changeset**: A collaboration submission containing an ordered group of mutations.

### 1. Record changes

**When edits are submitted.** User or Agent edits produce mutations, which are packaged into a changeset and submitted for collaboration confirmation and persistence.

```mermaid
flowchart LR
    A["Edit content"]
    B["Mutation"]
    C["Changeset"]
    D["Confirm and persist<br/>Record revision"]
    A --> B
    B --> C
    C --> D

```

A **revision** identifies a confirmed submission’s position in document history. History indexes confirmed changesets and groups them by time and operation to build the version timeline.

### 2. Reconstruct historical content

**When a historical version is selected.** A snapshot is the complete content state at a revision. The system loads a baseline snapshot and the subsequent changesets up to the target revision, then replays their mutations in order to produce a read-only historical view.

```mermaid
flowchart LR
    A["Select version<br/>revision N"]
    B["Load snapshot<br/>+ later changesets"]
    C["Replay mutations<br/>in order"]
    D["Historical content<br/>Read-only view"]
    A --> B
    B --> C
    C --> D

```

For example: **snapshot at revision 10 + changesets for revisions 11–15 = content at revision 15.**

### 3. Restore the current document

**When Restore this version is selected.**

> Select a target version → Submit a restore mutation → Collaboration confirms → Update the current document at a new revision

The restore operation creates a new history record, while earlier versions remain available.

## Browse versions and changes

1. Open **Version history** from the editor and select a version.
2. Expand a version group to inspect individual revisions. Select an entry to review its content and changes in a read-only viewer.
3. Select **Restore this version** when a rollback is needed. Restoration updates the current shared document through collaboration, so other participants receive the change.

A version group can combine edits within a time window. Expand it to inspect individual revisions. **A history entry is not necessarily one keystroke or one generated Snapshot.**

### Read the change colors

| Marker | Meaning | Example |
| --- | --- | --- |
| 🟦 **Blue: updated** | Existing content changed. | A value, paragraph format, or object property was updated. |
| 🟩 **Green: inserted** | Content added in this version. | A new row, paragraph, record, or board object. |
| 🟥 **Red: deleted** | Content removed in this version. | Removed text or objects retain a visual marker in the history view. |

Colors indicate **change types**. A text replacement may show both an insertion and a deletion. Each product viewer determines the highlighted scope.

## History across five products

The following Northstar project examples use English content and expanded timelines to show content alongside the underlying actions.

### Sheets

Review budget and forecast adjustments in Launch Budget, together with row insertions and deletions. The worksheet and action timeline help locate the area affected by each change.

![Sheets history: an English launch budget with an expanded change timeline](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/features/history/sheets.png)

[Integrate Sheets history](https://docs.univer.ai/guides/sheets/features/edit-history.md)

### Docs

Inspect the launch date, paragraph formatting, and customer-readiness additions in Product Launch Brief. Deleted text remains visible with red strikethrough, keeping revisions in context.

![Docs history: paragraph changes, deleted text, and expanded revision details](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/features/history/docs.png)

[Integrate Docs history](https://docs.univer.ai/guides/docs/features/edit-history.md)

### Slides

Trace target metrics and page objects in Launch Review. Select a history entry to see updated, inserted, and removed objects directly on the slide.

![Slides history: a launch-review slide and its object-change timeline](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/features/history/slides.png)

[Integrate Slides history](https://docs.univer.ai/guides/slides/features/edit-history.md)

### Relational Table

Review task, owner, and status changes in Launch Tracker. Record and field changes appear in the table context, helping explain when and how business data changed.

![Relational Table history: a launch tracker with its expanded record-change timeline](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/features/history/bases.png)

[Integrate Relational Table history](https://docs.univer.ai/guides/bases/features/edit-history.md)

### Canvases

Revisit planning cards and object properties in Release Workspace. Inserted, deleted, and updated objects remain marked in their spatial context, making a planning revision easier to follow.

![Canvases history: a release-planning board with its expanded object-change timeline](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/features/history/boards.png)

[Integrate Canvases history](https://docs.univer.ai/guides/boards/features/edit-history.md)

### PDF

**Coming soon**: PDF version history is not yet available.

## Integrate with your application

Version history combines the Server SDK History extension with Web SDK product history plugins:

- **Server**: add History Service, Endpoint, and a persistent Database Adapter to Core Collaboration. The service subscribes to Unit creation and committed changesets, builds a history index, and exposes version and changeset queries.
- **Browser**: register the common history capability and the product's History / History UI plugins, then connect the history endpoint. The viewer loads the selected revision and displays its changes. Register the appropriate viewer plugins for custom content.
- **Permissions**: your application supplies identity and authorization; the server checks history-read and restore permissions. Historical versions can contain data already removed from the current document.

See [collaboration extensions](https://docs.univer.ai/server/collaboration/extensions.md), assemble the service with the [History example](https://docs.univer.ai/server/collaboration/examples.md#history), then connect the UI using the product guides above.

History indexes are rebuildable derived data. **Confirmed changesets remain the authoritative content source.** Your application controls persistence and retention; the history panel does not replace backups.

## History, undo, comparison, and Worktree

| Capability | Purpose |
| --- | --- |
| Undo / redo | Revert or reapply editing operations without a history service. |
| Version history | Trace confirmed versions across sessions, inspect changes, and restore shared content. |
| [Content comparison](https://docs.univer.ai/overview/features/shared/compare.md) | Compare two content states for a UI or Agent. Read-only comparison does not restore content. |
| [Worktree](https://docs.univer.ai/overview/features/shared/worktree.md) | Isolate draft changes for review before merging them into shared content. |

Agent changes made through Facade APIs can enter the same history pipeline once collaboration confirms them. Applications can combine history with content comparison for automated review and checks.

[Back to all features](https://docs.univer.ai/overview/features.md)
