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

# Commit management

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/fusion/5.9/ozi0ub

[localhost link]: http://localhost:3000/docs/5/fusion/operations/config-sync/commits-management

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/operations/config-sync/commits-management

ConfigSync uses a GitHub repository to store the configuration files.

It pulls the latest changes from the repository every 30 seconds by default, and applies them to the Fusion cluster.
You can configure the polling interval; see the [ConfigSync configuration reference](/docs/5/fusion/operations/config-sync/settings).

At the same time, it listens to the changes in the Fusion cluster and pushes them to the GitHub repository.

Fusion cluster changes have a higher priority than GitHub repository changes in case of conflicts.

<LwTemplate />

## Latest synced commit

The latest synced commit is the commit that was last applied by ConfigSync.
ConfigSync tracks it as `latest-synced-commit` whose value is the Git commit hash.
It uses this value to determine which commits to apply.

ConfigSync applies all commits that are newer than `latest-synced-commit` and sets `latest-synced-commit` to the latest commit.

For example, imagine the following Git commit history:

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit1.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=5f4dc455b58402d984bd8d9345920201" alt="Commit history" width="916" height="412" data-path="assets/images/diagrams/config-sync/commit1.png" />

When ConfigSync performs a `git pull` and finds a new commit, it applies it and sets `latest-synced-commit` to the latest commit.

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit2.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=53cf85c62459423de7423c79bf24c045" alt="Commit history" width="1008" height="434" data-path="assets/images/diagrams/config-sync/commit2.png" />

ConfigSync calculates the difference between `latest-synced-commit` and `latest-git-commit` and applies all commits within that range.
Then it sets `latest-synced-commit` to `latest-git-commit`.

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit3.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=39f07d80d44f63b229ab2f2e62645c12" alt="Commit history" width="1022" height="446" data-path="assets/images/diagrams/config-sync/commit3.png" />

If needed, you can set `latest-synced-commit` manually:

```bash theme={"dark"}
PUT /api/properties/latest-synced-commit
Content-Type: text/plain

1111111
```

This sets `latest-synced-commit` pointer to `1111111`.

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit4.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=99c18bbce0c06407b65513a028210784" alt="Commit history" width="1024" height="430" data-path="assets/images/diagrams/config-sync/commit4.png" />

After that, ConfigSync reapplies all commits that are newer than `latest-synced-commit` and set `latest-synced-commit` to the latest commit.

## Locked commit

ConfigSync can lock the configuration to a specific commit.

This means that ConfigSync :

* Does not apply any commits that are newer than the locked commit
* Does not update changes from the Fusion cluster to the GitHub repository

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit5.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=2134eec9c7af53009e18651ad337b81a" alt="Commit history" width="938" height="428" data-path="assets/images/diagrams/config-sync/commit5.png" />

You can set `locked-commit` using the API:

```bash theme={"dark"}
PUT /api/properties/locked-commit
Content-Type: text/plain

2222222
```

<Note>
  If `locked-commit` precedes `latest-synced-commit`, ConfigSync reverts all changes to the `locked-commit` and sets `latest-synced-commit` to `locked-commit`.
</Note>

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit6.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=3fbb67c33331565c19f357bc028d2a00" alt="Commit history" width="946" height="566" data-path="assets/images/diagrams/config-sync/commit6.png" />

All commits that are newer than `locked-commit` are ignored, as well as changes from the Fusion cluster.

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit7.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=f0b0b78a30ccb399d799134f8b6b69d1" alt="Commit history" width="1140" height="592" data-path="assets/images/diagrams/config-sync/commit7.png" />

After we remove the `locked-commit`, ConfigSync commits all Fusion cluster changes and pulls the latest changes from the GitHub repository:

```bash theme={"dark"}
DELETE /api/properties/locked-commit
```

That triggers a merge between `git-changes` and `fusion-changes` where `fusion-changes` has a higher priority in case of conflicts.

<img src="https://mintcdn.com/lucidworks/pcVooZE8fTjtTbXE/assets/images/diagrams/config-sync/commit8.png?fit=max&auto=format&n=pcVooZE8fTjtTbXE&q=85&s=ec62c814aea725e5a134981a46cbf8b2" alt="Commit history" width="1220" height="596" data-path="assets/images/diagrams/config-sync/commit8.png" />
