> ## 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.

# Syncing content to git

> Learn how a draft of a document that requires a pull request to publish becomes a pull request, what happens when you discard or move a draft, and how Omni keeps the base branch current.

> [!NOTE]
>
> This feature is currently in beta. Reach out to Omni support to have it enabled for your organization.

This page describes how Omni moves a document that requires a pull request to publish into your git repository, and how the repository stays current after the pull request is merged.

## Before you begin

Omni only commits a document to git when the document requires a pull request to publish. To set this up:

1. Enable **Require pull requests to publish** under **Settings > Content Permissions**. You need **Organization Admin** permissions.
2. Open the document and enable **Require pull requests to publish** under **File > Document settings**. You need the **Manager** role on the document.

The document's model must be connected to git. For the full list of requirements, refer to [Content in git](https://docs.omni.co/integrations/git/content#requirements).

## Publishing documents through pull requests

1. Open the document and click Edit. Omni will ask you to make the change on a branch. Pick an existing branch or create a new one.
2. Make your changes. The branch header shows that the document needs a pull request before the draft can be published.
3. When you're ready, click **Create pull request** in the branch header, then commit the branch or open the pull request. Either action writes the document files to the branch.
4. Omni fetches the content changes and writes the diffs into `omni/content/` on the branch. Model changes on the same branch are committed alongside them.
5. In your git provider, the pull request diff shows the changed model and document files together.  See [Repository structure for content in git](https://docs.omni.co/integrations/git/content/repository-structure.md) for more information about the files' contents and overall structure.
6. When the pull request is merged, Omni publishes the draft and the base branch reflects the published version that document.

Documents that don't require a pull request are published on merge as before, but their files are not committed.

## Discarding and moving drafts

* If you discard a draft on an active branch, Omni will discard the diffs in git to reflect the published state of the document.
* A document that doesn't have a draft on the branch keeps the folder it has on the base branch.

## How Omni keeps the base branch current

Omni runs background syncs to the base branch to check that what's stored in git matches with Omni's current state. For documents, it checks that every document that requires a pull request has up-to-date files in `omni/content/`. It then:

* Adds files for documents that are missing from the repository
* Refreshes files for documents whose published version has changed
* Moves files for documents that moved to a different Omni folder
* Removes files for documents that no longer require a pull request

> [!NOTE]
>
> If [Require for system syncs](https://docs.omni.co/integrations/git/settings.md#require-for-system-syncs) is enabled for the model, Omni doesn't directly commit document file changes to the base branch. A pull request is required to merge the changes.

## Next steps

* [Repository structure](https://docs.omni.co/integrations/git/content/repository-structure.md) - Learn how Omni structures content committed to git
* [Troubleshooting](https://docs.omni.co/integrations/git/content/troubleshooting.md) - Get help with blocked commits and stand-in files


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