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

# Pull and push changes

> On a Git v2 repository, commits on a pull request branch wait in git until you pull them into the Omni branch. Use the branch header in the model IDE to pull commits and push your edits.

> [!NOTE]
>
> Git v2 is available for GitHub repositories. To have Git v2 turned on for your organization, reach out to Omni support.

On a repository that uses [Git v2](https://docs.omni.co/integrations/git/v2), you move changes between an Omni branch and its pull request yourself.

## How it works

* **Commits wait in git until you pull them.** When someone pushes a commit to the pull request branch in GitHub, Omni runs its checks on the commit and leaves the commit in git.
* **Edits stay in Omni until you push them.** Your edits are in the Omni branch until you push them to the pull request.

When a commit waits in git, Omni's comment on the pull request says:

```text theme={null}
Omni has not pulled this commit into the branch yet; pull it from the IDE
```

To bring the commit into the Omni branch, [pull it from the branch header](#pull-changes-from-git).

If the Omni branch has edits that you haven't pushed, the comment says:

```text theme={null}
Omni has edits not pushed to this PR; update the pull request from Omni to merge them in
```

Omni pulls a commit for you in these cases:

* **Omni creates a branch for the pull request.** Omni pulls the commit into the new branch.
* **The pull request merges.** Omni pulls the merge into the shared model.
* **The model is in [git follower mode](https://docs.omni.co/integrations/git/follower-mode).** Omni pulls each commit into the Omni branch.

## The branch header

The branch header is the header at the top of the model IDE when you work in a [branch](https://docs.omni.co/content/develop/branch-mode.md). After the branch has an open pull request, the header shows these controls:

| Control | What it does | Tooltip |
| - | - | - |
| Up arrow | Pushes your edits in Omni to the pull request. The arrow is dimmed when there is nothing to push. | **Push edits to the pull request** |
| Down arrow | Pulls the pull request's commits into the Omni branch. The number next to the arrow is the count of commits waiting in git. The arrow is dimmed when the count is 0. | **Pull the pull request's latest changes into `<branch name>`.** |
| Pull request link | Opens the pull request in GitHub in a new tab. The link shows the pull request number, for example **PR #128**. | **View pull request** |

The same actions are in the **Branch options** menu, which you open with the dots icon at the left of the header:

* **View pull request**
* **Pull from git**
* **Update pull request**

On the shared model, the **Shared** badge shows the state of the base branch. See [See the base branch state in the model IDE](https://docs.omni.co/integrations/git/v2/merging.md#see-the-base-branch-state-in-the-model-ide).

### Automatic refresh

The header reads the branch's git state when the model IDE loads, and again every 30 seconds while the browser tab is visible. The refresh pauses while the tab is hidden. When you return to the tab, the header reads the state again.

When the pull request merges or the Omni branch pulls a new commit from git, the page reloads the branch.

## Pull changes from git

A pull brings the pull request's latest commits into the Omni branch.

1. Open the branch in the model IDE.
2. Click the down arrow in the branch header, or click **Branch options > Pull from git**.

The pull starts immediately. When it finishes, Omni shows one of these messages:

| Message | What happened |
| - | - |
| **Pulled the latest changes from git.** | The Omni branch has the pull request's latest commit. |
| **Pulled the changes in git into Omni's edits; push to update the pull request.** | The Omni branch had edits that were not in git. Omni merged the commits from git into your edits. Push to send the result to the pull request. |
| **Nothing to pull: the branch is up to date with git.** | The Omni branch already has the pull request's latest commit. |
| **Could not pull from git: `<error>`** | The pull failed. The message includes the error. |

The pull controls are unavailable for a short time while the header refreshes the branch's git state.

## Push changes to the pull request

A push commits your edits in the Omni branch to the pull request branch in GitHub.

1. Open the branch in the model IDE.
2. Click the up arrow in the branch header, or click **Branch options > Update pull request**.
3. If the branch has edits that are not in git, the **Update Pull Request** dialog opens. Enter a message in the **Commit Message** field, which is required, and click **Update**.

Omni commits the branch's model files to the pull request branch with your commit message.

If the branch has no edits of its own and the shared model changed after the branch was last updated, the push starts immediately. Omni merges the shared model's changes into the pull request with the commit message `Merge changes from base model`.

If the pull request has commits that the Omni branch doesn't have, Omni pulls them first and then pushes.

When the push finishes, Omni shows one of these messages:

| Message | What happened |
| - | - |
| **Pull request updated.** | Omni committed your edits to the pull request branch. |
| **Pulled the changes in git into the branch and updated the pull request.** | Omni pulled the commits waiting in git, then committed your edits. |
| **Could not push because the pull request updated while pushing. Pull from git, then push again.** | A commit arrived on the pull request branch during the push. Pull, then push again. |

### When the push control is disabled

The up arrow and the **Update pull request** menu item are disabled when there is nothing to push. The tooltip shows **No local changes**.

The control becomes available when one of these is true:

* The Omni branch has edits that are not in git.
* A document draft on the branch that requires a pull request has new edits.
* The shared model changed after the branch was last updated.

## The normalize commit

After a commit from outside Omni arrives on the pull request branch, Omni compares the model files in the commit with the way Omni writes the same files. If the files differ, Omni adds a commit to the pull request branch that rewrites them in Omni's format. The commit message is:

```text theme={null}
Normalize model files as Omni writes them

Omni rewrote the model files from <commit> to match its own serialization format, so
pull request #<number> matches what Omni's own commits would write.
```

The commit keeps the files in git the same as the files a push from Omni writes.

The normalize commit counts as a commit to pull, so pull it into the Omni branch.

Omni runs its checks again on the normalize commit, and the pull request comment for that commit says:

```text theme={null}
Omni rewrote the files on this commit to match its serialization format.
```

In some cases Omni finds files that it writes differently and leaves them as they are. The pull request comment then includes **Omni writes N files differently but did not rewrite them** or **Omni writes N files differently but could not rewrite them**, gives the reason, and lists the files under **Files Omni writes differently**.

## When the model files in git have errors

Omni can't pull a commit whose model files it can't read. Examples are a YAML file that doesn't parse and a property with a value of the wrong type.

When the latest commit on the pull request has these errors, the branch header changes:

* A warning icon appears next to the arrows.
* The warning icon and both arrows show the tooltip **The model files in git have errors. Click for details.**
* The **Branch options** menu shows **Model files in git have errors...** in place of the pull and push items.

Click the warning icon or one of the arrows to open the **Model files in git have errors** dialog. The dialog names the commit and the branch, shows the error, and says:

> The model files in commit `<commit>` on `<branch name>` have errors, so this commit can’t be pulled until they are fixed.
>
> Fix the errors in git and push. Once Omni sees the new commit, you can pull and push again. Your edits in Omni stay in the branch and go up on the next push.

The dialog has three buttons:

* **View pull request** - Opens the pull request in GitHub in a new tab. The pull request comment shows the same error.
* **Pull again** - Tries the pull again. Use this button if you fixed the errors in git and the header still shows the warning.
* **Close** - Closes the dialog.

To make pull and push available again:

1. Fix the errors in the model files in git.
2. Push the fix to the pull request branch.
3. Wait for the branch header to refresh, then pull.

## Next steps

* [Resolve conflicts](https://docs.omni.co/integrations/git/v2/conflicts.md)
* [Troubleshooting Git v2](https://docs.omni.co/integrations/git/v2/troubleshooting.md)
* [Git v2 settings](https://docs.omni.co/integrations/git/v2/settings.md)
* [Branch Mode](https://docs.omni.co/content/develop/branch-mode.md)
