> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Branches and Git for extension models

> How each branch workflow behaves for a shared extension model, including which Git repository the extension uses.

A shared extension model can have one of two branch workflows, which you select when you [create the extension](https://docs.omni.co/modeling/develop/shared-extensions/setup.md):

| Workflow | Branches | Git |
| :- | :- | :- |
| **Develop with the parent model** (default) | On the parent model | Included in the parent model's repository |
| **Develop independently** | On the extension only | Optional, in the extension's own repository |

You can change the workflow in the [extension model's settings](https://docs.omni.co/modeling/develop/shared-extensions/settings.md#branch-workflow).

## Requirements

To follow the steps in this guide, you'll need:

* A [shared extension model](https://docs.omni.co/modeling/develop/shared-extensions)
* **Connection Admin**, **Modeler**, or **Querier** [permissions](https://docs.omni.co/administration/users/permissions.md) on the extension model
* For **Develop with the parent model**, **Connection Admin**, **Modeler**, or **Querier** permissions on the parent model. Omni creates the branch on the parent model, so permissions on the extension alone are not sufficient.
* For Git in the **Develop with the parent model** workflow, a parent model [linked to a Git repository](https://docs.omni.co/integrations/git).
* For Git in the **Develop independently** workflow, a Git repository linked to the extension. See [Git repository for the extension](#git-repository-for-the-extension).

## Develop with the parent model

In this workflow, the extension shares branches with the parent model.

### Branches

When you create a new branch in the extension's model IDE, Omni creates the branch on the parent model.

One branch contains the changes to the parent model and to every extension in this workflow. When you edit the extension in [Branch Mode](https://docs.omni.co/content/develop/branch-mode.md), Omni saves the change to that branch.

When you merge the branch, Omni applies the parent changes and the extension changes together.

### Git

> [!NOTE]
>
> Git sync for extensions is not enabled by default. Reach out to Omni support to have this feature enabled.

If the parent model is linked to Git, the extension is part of the same repository.

#### Extension files in the repository

Omni writes each extension to a folder next to the parent model's folder, at `<model path>.extensions/<extension name>/`. An extension folder contains only the extension's own definitions.

```text theme={null}
omni/
  sales/                    # Parent model
    model.yaml
    orders.view.yaml
  sales.extensions/         # Extensions in the "Develop with the parent model" workflow
    finance/
      orders.view.yaml
    emea__central/          # Extension named "emea/central"
      regional.topic.yaml
```

#### Editing

You can't edit the extension directly. Edit it in [Branch Mode](https://docs.omni.co/content/develop/branch-mode.md), the same as the parent model.

#### Commits and pull requests

When you add a commit to a branch or open a pull request, Omni writes the parent model and every extension to the repository. The parent model's [Git settings](https://docs.omni.co/integrations/git/settings.md) apply to the extension:

* **If Pull request required is enabled**, a pull request is required to merge changes to the extension.
* **If the parent model is in [follower mode](https://docs.omni.co/integrations/git/follower-mode)**, you cannot edit the extension in Omni.

> [!WARNING]
>
> A user who can create a branch on the parent model can also edit the parent model's files on that branch. Omni does not stop these edits from being included in the same pull request as extension changes. To make sure the owners of the parent model review them:
>
> * **In `CODEOWNERS`**, set owners for the parent model's folder, not only for each extension folder.
> * **In your Git provider**, set branch protection to require review from code owners and at least one approval.
> * **In the parent model's Git settings**, enable [**Pull request required**](https://docs.omni.co/integrations/git/settings.md#pull-request-required).

#### Merges

When you merge a pull request, Omni applies both the parent changes and the extension changes. This is also true for a pull request that changes only extension files.

#### Changes made in Git

When a pull request changes files in an extension folder, Omni reads the whole folder into the branch. The definitions in Git replace the extension's definitions in the Omni branch, and a file the pull request deletes is removed from the branch.

> [!WARNING]
>
> This replacement includes edits made in Omni that you have not committed to the branch.

If a pull request deletes the entire extension folder, Omni does not change the extension. It writes the folder again at the next commit or sync, which reverts the deletion.

#### API sync

The [Git sync endpoint](https://docs.omni.co/api/model-git-configuration/sync-model-with-git-repository.md) accepts the ID of an extension in this workflow. The sync runs on the parent model and includes every extension in this workflow, not only the extension named in the request.

## Develop independently

In this workflow, a branch holds the extension's changes in a layer on the extension itself, not on the parent model. The extension is not included in the parent model's repository. It can link its own Git repository instead. Without a linked repository, you merge extension branches in Omni.

This workflow lets you:

* Develop and test changes to the extension without a branch on the parent model
* Give a team its own development and release cycle
* Create branches from existing branches on the extension
* Link the extension to its own Git repository

### Creating a branch on the extension

1. In the model IDE, click **Model > Branch > New branch**. In a workbook, click **Develop > Branch > New branch**.
2. Enter a name for the branch.
3. In the **Branch from** dropdown, select the starting point:

   * **Shared extension (latest)** - Starts from the latest version of the extension
   * **Existing branch** - Starts from another branch on the extension. Select the branch in the dropdown that appears.
4. Click **Create**.

### Git repository for the extension

An extension in this workflow can link its own Git repository, separate from the parent model's repository. The extension has its own [Git settings](https://docs.omni.co/integrations/git/settings.md): **Pull request required**, [follower mode](https://docs.omni.co/integrations/git/follower-mode), and auto-sync are independent of the parent model's.

To switch the extension back to **Develop with the parent model** later, you must unlink the repository first. See [Changing the branch workflow](#changing-the-branch-workflow).

When the extension is linked to Git:

* Commits, pull requests, merges, and syncs run against the extension's repository.
* You can't edit the extension directly. Edit it in [Branch Mode](https://docs.omni.co/content/develop/branch-mode.md).
* By default, Omni writes the extension's files to `<model path>.extensions/<extension name>/`, where `<model path>` is the parent model's path.
* The repository can be the parent model's repository or a different one.
* If the parent model uses the same repository, the parent model's sync doesn't write to or delete the extension's folder.
* The [Git sync endpoint](https://docs.omni.co/api/model-git-configuration/sync-model-with-git-repository.md) and the [Git configuration endpoints](https://docs.omni.co/api/model-git-configuration/get-git-configuration.md) accept the extension's ID.

To link a repository, click **Model > Advanced > Git settings** in the extension's model IDE and follow the [Git integration setup guides](https://docs.omni.co/integrations/git/setup). Once linked, this menu opens the extension's own Git settings, not the parent model's.

### Limitations

* [Branch-based schema refreshes](https://docs.omni.co/modeling/develop/schema-refreshes.md#requiring-branches-for-schema-refreshes) aren't supported in an extension branch.
* [Table migrations](https://docs.omni.co/modeling/develop/table-migration.md) aren't supported in an extension branch.

## Changing the branch workflow

* **From Develop with the parent model to Develop independently** - Omni stops writing the extension to the parent model's repository. It doesn't delete the existing folder, so delete it in your repository if you no longer want it. The extension starts with no Git configuration, and you can then link a repository to it.
* **From Develop independently to Develop with the parent model** - Unlink the extension's repository first, in **Model > Advanced > Git settings**. Otherwise Omni refuses the change with `Unlink the git repository from this extension before turning off isolated branches`. After the change, Omni writes the extension to the parent model's repository at the next commit, pull request, or sync, and replaces any old definitions in the extension's folder.

## Troubleshooting

> [accordion] Parent model changes don't appear in the extension
>
> Extensions receive changes from the parent model as soon as the parent model is saved.
>
> If a change does not show up, the change is still in a branch. Merge the branch, or if the parent model is linked to Git, merge the pull request.
>
> If the extension overrides the same object, the extension's definition is what users see, so check the extension for an override.

## Next steps

* [Branch Mode](https://docs.omni.co/content/develop/branch-mode.md) - Working with branches in Omni
* [Git integration](https://docs.omni.co/integrations/git) - Connecting a model to a Git repository
* [Extension settings](https://docs.omni.co/modeling/develop/shared-extensions/settings.md) - Changing the branch workflow and other extension settings
* [Set up a shared extension](https://docs.omni.co/modeling/develop/shared-extensions/setup.md) - Creating an extension and granting access


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.