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

# Hard Locks

> Prevent conflicting edits by exclusively locking files and folders

Hard locks give a user exclusive write access to a specific path in a repository. While [soft locks](/coming_from_perforce#soft-locking-vs-hard-locking) are non-blocking indicators that show when someone is editing a file, hard locks **prevent** other users from committing changes to the locked path until the lock is released.

Hard locks are especially useful for binary files (such as `.uasset`, `.umap`, or `.fbx`) that cannot be merged and require exclusive editing.

<Note>Hard locks are available on **Studio** and **Enterprise** plans.</Note>

## How Hard Locks Work

* A lock is **per-repository** and **per-path** — each lock applies to a specific path in a specific repo.
* A lock is tied to the **user** who created it.
* Once a path is locked, **only the locking user** can commit changes to that path.
* If another user edits a locked file locally, a **warning** is displayed but the edit is saved. However, **committing** those changes will be **blocked**.
* Only the **locking user** or a **repository admin/owner** can release the lock.

## Locking and Releasing Paths

### Using the Desktop or Web App

To lock a path, right-click the file or folder in the tree view and select **Lock** from the context menu.

<img src="https://mintcdn.com/diversion-2/ZjpGQ8XTMbK9M7v-/images/hard-locks/context-menu-lock.png?fit=max&auto=format&n=ZjpGQ8XTMbK9M7v-&q=85&s=b92c5bc7b2d387b21e5caf7df9b39017" alt="Lock option in the context menu" style={{width: '300px', borderRadius: '1.0rem', border: '.2rem solid #555', boxShadow: '0 0 1rem #888'}} width="472" height="304" data-path="images/hard-locks/context-menu-lock.png" />

Once locked, a lock icon appears next to the path in the tree view, indicating who holds the lock.

<img src="https://mintcdn.com/diversion-2/ZjpGQ8XTMbK9M7v-/images/hard-locks/lock-status-tree-view.png?fit=max&auto=format&n=ZjpGQ8XTMbK9M7v-&q=85&s=a70092621ec4da47be16e2672189ed5c" alt="Lock status indicator in the tree view" style={{width: '300px', borderRadius: '1.0rem', border: '.2rem solid #555', boxShadow: '0 0 1rem #888'}} width="504" height="338" data-path="images/hard-locks/lock-status-tree-view.png" />

To release a lock, right-click the locked path and select **Unlock** from the context menu.

<Warning>Only the user who created the lock or a repository admin/owner can release it. If the locking user is unavailable, contact a repo admin.</Warning>

### Using the CLI

Lock a path:

```bash theme={null}
dv lock <path>
```

Release a lock:

```bash theme={null}
dv lock -d <path>
```

List all locked paths in the repository:

```bash theme={null}
dv lock
```

## Auto-Lock

Repository admins can configure file patterns (by extension) so that matching files are **automatically locked** when a user begins editing them. This removes the need for manual locking on common binary or unmergeable file types.

### How Auto-Lock Works

* When a user edits a file that matches a configured pattern, Diversion automatically locks it for that user.
* If the file is **already locked by another user**, auto-lock does not apply — the existing lock is preserved.

<Note>Auto-lock is particularly useful for binary files like `.uasset`, `.umap`, or `.fbx` that cannot be merged and always require exclusive editing.</Note>

### Configuring Auto-Lock Patterns

Auto-lock is a per-repository setting configured by a repo admin or owner.

1. Click your **profile avatar**, select **Your organizations**, then select **Repositories** in the sidebar and **Hard locks** in the repository column
2. Use the repository picker at the top of the repository column to select the repository
3. Add file extension patterns (e.g., `.uasset`, `.umap`, `.fbx`)
4. Save changes

<img src="https://mintcdn.com/diversion-2/ZjpGQ8XTMbK9M7v-/images/hard-locks/auto-lock-settings.png?fit=max&auto=format&n=ZjpGQ8XTMbK9M7v-&q=85&s=0ec5dd78eefec9fb0bb85e00ed57c4ee" alt="Auto-lock configuration in repository settings" style={{width: '500px', borderRadius: '1.0rem', border: '.2rem solid #555', boxShadow: '0 0 1rem #888'}} width="546" height="220" data-path="images/hard-locks/auto-lock-settings.png" />

## Auto-Release

Locks can be automatically released when the locking user commits changes on specific branches. This is configured alongside the auto-lock settings.

### How Auto-Release Works

* A repository admin defines which **branches** trigger auto-release (e.g., `main`, `develop`).
* When a user commits or merges to one of these branches, their locked files included in the commit are automatically released.

<img src="https://mintcdn.com/diversion-2/ZjpGQ8XTMbK9M7v-/images/hard-locks/auto-release-settings.png?fit=max&auto=format&n=ZjpGQ8XTMbK9M7v-&q=85&s=4d00137f99f510a10d7c70fff08cf281" alt="Auto-release branch configuration in repository settings" style={{width: '500px', borderRadius: '1.0rem', border: '.2rem solid #555', boxShadow: '0 0 1rem #888'}} width="516" height="156" data-path="images/hard-locks/auto-release-settings.png" />

## Viewing Locked Paths

* **Desktop or Web App:** Lock icons appear in the tree view next to locked paths. Hover over the icon to see who holds the lock.
* **CLI:** Run `dv lock` with no arguments to list all locks in the repository.

## Permissions

| Action                               | Who can do it                          |
| ------------------------------------ | -------------------------------------- |
| Lock a path                          | Any user with write access             |
| Unlock own lock                      | The locking user, repo admin, or owner |
| Unlock another user's lock           | Repo admin or owner                    |
| Configure auto-lock/release settings | Repo admin or owner                    |
