---
title: "Keep unlimited layout history on GitHub"
description: "Connect a GitHub repository to keep every version of your email layouts, restore any of them and edit layouts in GitHub."
canonical: "https://docs.workflow-transactional-email.app/layout-history-on-github"
---

# Keep unlimited layout history on GitHub

The app keeps the newest **25 versions** of every email layout. Connect GitHub and every version is also saved to a repository you choose, so your layout history is **unlimited**: see who changed what, restore any version, and keep a copy of your layouts outside the app.

## Connect GitHub

1. In the app, open **Developer** and the **Connections** tab.
2. Under **GitHub**, click **Connect GitHub**. GitHub opens in a new tab.
3. Install the app on your GitHub account or organization and choose which repositories it may use. A private repository is recommended. If you do not have one yet, create it first on <a href="https://github.com/new" target="_blank" rel="noopener">github.com/new</a>.
4. Back in the app, pick the repository under **Repository** and click **Use this repository**.

The app writes every layout you already have to the repository right away, then commits each new version as you save.

> [!NOTE]
> **What the app can access**
> Only the repositories you grant during installation, and only their files. You can change the repositories or remove the app on GitHub at any time with **Manage permissions**.

## What is in the repository

One file per layout in the `email-layouts` folder, named by the layout's id, for example `email-layouts/cmu3010yo01e4yn0wdjmh7xab.json`. It holds the layout's name, subject, preview text, content or visual design, and every translation. Each save in the app, through the API, by AI or by a restore is one commit with a message such as `Update "Order confirmation" (editor, v12)`.

Deleting a layout in the app deletes its file; the earlier commits keep its history.

## Restore an older version

Open the layout and click **Version history**. Below the newest versions kept in the app, **Older versions on GitHub** lists every commit of the layout. Click **View** to preview one and **Restore this version** to put it back. The restore is saved as a new version, so it can be undone.

## Edit a layout in GitHub

Change a layout's file in the repository and commit it to the connected branch: the app updates the layout within seconds. The file is checked like a save in the app: Liquid must be valid, links and colors must be safe and files must be uploaded to your store. A file that fails the check is ignored and the layout stays as it was.

A file cannot create a new layout, and deleting a file does not delete a layout, so a mistaken commit never breaks an email that is sending.

## Disconnect

**Developer > Connections > GitHub > Disconnect GitHub** removes the connection and the app's access. The repository and its history stay in your GitHub account.

## Through the API

`GET /api/v1/email-templates/:id/versions/github` lists the versions on GitHub, and `POST /api/v1/email-templates/:id/versions/github/:sha/restore` restores one. The MCP tools are `list_template_versions` with `github: true` and `restore_template_github_version`.
