Unity File Locking

How to Use Git LFS File Locking for Unity Scenes and Prefabs

Git LFS locking can prevent parallel edits to non-mergeable Unity assets, but scenes and prefabs require a deliberate tradeoff. They are text-mergeable under Force Text, while normal LFS tracking replaces their Git content with pointers. Lock binary assets by default and lock text-serialized assets only when conflict cost justifies reduced parallel work.

7 Wolves July 29, 2026 9 min read Git Setup

The basic Git LFS lock workflow

git lfs locks
git lfs lock "Assets/Art/Character.psd"
# edit, commit, and push the asset
git lfs unlock "Assets/Art/Character.psd"

For a file type that should be stored in LFS and treated as lockable:

git lfs track --lockable "*.psd"
git add .gitattributes

The lock is a server-side coordination record. Every contributor needs Git LFS installed, authentication to the same remote, and a client workflow that makes lock ownership visible before editing.

Should scenes and prefabs be lockable?

There is no universal answer. A text-serialized .unity or .prefab file can be reviewed and merged. Putting it under the standard LFS filter hides that content from normal Git and prevents UnityYAMLMerge from receiving the real YAML through the ordinary merge path.

AssetDefault policyException
Binary art sourceLFS + lockableAllow parallel work only if the authoring tool provides its own merge path.
Small text prefabNormal Git + review/mergeTemporary ownership for a risky restructure.
Shared level sceneNormal Git with strict workflowLock during high-overlap layout, lighting, or bake operations.
Generated/baked binary dataLock or regeneratePrefer reproducible generation when practical.

Define the policy before the commands

  • Which extensions are always LFS and lockable?
  • Which text assets use temporary ownership without LFS storage?
  • How does a developer announce and discover scene ownership?
  • When is a lock released: after push, review, or merge to main?
  • Who can remove stale locks, and how is abandoned work preserved?
  • What happens when a lock service is unavailable?

A lock without an agreed lifecycle easily becomes a new source of blocked work.

Keep a merge path for text assets

For most scenes and prefabs, keep Force Text and normal Git storage, then use UnityYAMLMerge for straightforward automatic cases. When the result needs human trust, MergeSight scene and prefab conflict review adds visible Base / Ours / Theirs decisions, hierarchy, references, preview, and validation.

This supports parallel work while preserving a safe escalation path. Lock only the assets or edit windows where the team knows merging will be more expensive than waiting.

Daily locking checklist

  1. Pull or fetch the latest target branch before acquiring a lock.
  2. Check existing locks and confirm the local file is the latest revision.
  3. Acquire the lock and announce the expected edit window.
  4. Keep the change focused; do not hold a scene lock across unrelated work.
  5. Review and validate the asset before pushing.
  6. Release the lock according to the team's merge policy.

Common lock failures

  • A developer edits before checking lock state.
  • The file is marked lockable locally but .gitattributes was not committed.
  • Different remotes or credentials point contributors at different lock servers.
  • A stale lock is removed without preserving the owner's unpushed work.
  • Text scenes are moved to LFS without realizing that diffs and Smart Merge disappear.
  • Locks stay open through code review and block unrelated follow-up work.

FAQ

Can Git LFS lock Unity scene files?

It can coordinate locks, but standard LFS tracking replaces scene YAML with pointer files in normal Git. Use that tradeoff deliberately rather than making every scene an LFS asset by default.

What Unity assets should be lockable?

Large non-mergeable binary assets are the clearest candidates. High-risk shared scenes or prefabs can use temporary ownership or locks when parallel edits are consistently more expensive than coordination.

How do I see and release Git LFS locks?

Use git lfs locks to list them, git lfs lock <path> to acquire one, and git lfs unlock <path> to release one.

Is file locking better than UnityYAMLMerge?

They solve different problems. Locking prevents parallel edits; UnityYAMLMerge combines text-serialized changes after parallel edits. Most teams use both selectively.

Summary

Lock binaries first

LFS + lockable is a natural fit for large assets that cannot be text-merged.

Protect text visibility

Do not move scenes and prefabs into LFS without accepting the loss of normal diff and merge.

Define lock lifecycle

Ownership, discovery, release, and stale-lock handling matter as much as the commands.

The right lock policy minimizes destructive overlap while preserving parallel work and review where Unity text serialization makes it possible.

Next step

Use the broader decision matrix in Unity File Locking vs Smart Merge before applying locks to text assets.