> For the complete documentation index, see [llms.txt](https://documentation.ocsinventory-ng.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ocsinventory-ng.org/user-docs/asset-management/inventory-and-templates/managing-template-versions.md).

# Managing template versions

Template versioning lets you save snapshots of an inventory template over time, compare them, and roll back to an earlier version if needed.

### Overview

Every time you save meaningful changes to a template, you can create a revision, a snapshot of the template as it was at that moment. Revisions let you:

* Keep a history of how a template evolved.
* Preview what the template looked like at a given point in time.
* Compare an older revision against the current template.
* Restore the template to a previous revision.

### Creating A Revision

Revisions are created from the template editor.

{% stepper %}
{% step %}
Go to **Configuration → Templates**.
{% endstep %}

{% step %}
Open the template you want to edit.

{% endstep %}

{% step %}
Make your changes, then click **Create a new revision**.

<figure><img src="https://461838061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtjrEC8kt8LJiJYFBs5CS%2Fuploads%2FTWhhjqY8IfzUOqWj0gOe%2Fimage.png?alt=media&amp;token=61962be2-5fa1-46a8-a94d-957218d6b82f" alt="" width="263"><figcaption></figcaption></figure>

This saves a snapshot of the template as it is at that moment. The template remains editable afterward, creating a revision does not lock it.
{% endstep %}
{% endstepper %}

### Viewing Revisions

Next to **Create a new revision**, a clock-with-arrow icon opens the list of all revisions saved for this template.

The revisions table shows each saved revision along with three actions:

| Action      | What it does                                                                                                                    |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Preview** | Opens the full template as it was in that revision.                                                                             |
| **Compare** | Shows the differences between that revision and the current template - additions, removals, and changes to fields and sections. |
| **Restore** | Replaces the current template with that revision.                                                                               |

{% hint style="warning" %}
Restoring a revision overwrites the current template. Any changes made since the last revision was created will be lost unless they were saved as a revision themselves.
{% endhint %}

### Configuring How Many Revisions Are Kept

By default, only a limited number of revisions are kept per template. Once that limit is reached, the oldest revision is removed each time a new one is created.

You can change this limit from the general server configuration.

{% stepper %}
{% step %}
Go to **Configuration → General configuration → Server**.
{% endstep %}

{% step %}
Set **Maximum number of template revisions** to the value you want.
{% endstep %}
{% endstepper %}

This setting applies to all templates. Lowering it removes older revisions the next time a new revision is created; it does not delete existing revisions immediately.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.ocsinventory-ng.org/user-docs/asset-management/inventory-and-templates/managing-template-versions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
