
In GitLab 18.0, the “Locked Files” feature under the Code section is specifically designed to help teams working with binary files or non-mergeable assets (e.g., images, CAD drawings, videos, large design files) where Git’s default merge model doesn’t work well.
๐ What are Locked Files in GitLab?
โ Definition:
Locked files are specific files in your repository that are locked by a user to prevent others from modifying them until the lock is released.
This is useful when concurrent editing would cause conflicts or corruption โ especially for binary or non-text files.
๐ Key Use Cases
| Use Case | Why Lock? |
|---|---|
Graphic design files (.psd, .ai, .fig) | Prevent designers from overwriting each other’s changes |
| Game development (Unity assets) | Avoid asset merge conflicts |
CAD/3D modeling files (.dwg, .blend) | Prevent corruption due to parallel edits |
| Audio/Video files | Version control without collisions |
| Any large binary file | Git can’t merge them cleanly โ one editor at a time is safest |
๐งญ How It Works in GitLab (18.0)
- Navigate to Project โ Code โ Locked Files
- Click โLock a fileโ
- Browse or search for the file you want to lock (must be in the default branch or your working branch)
- Once locked:
- Only the locker can commit changes to that file
- Others will get a commit error or merge conflict warning
- To unlock:
- The same user (or a Maintainer) can release the lock
๐ฆ Permission Rules
| Role | Can Lock? | Can Unlock? |
|---|---|---|
| Developer | โ Own locks | โ Other userโs locks |
| Maintainer | โ Any file | โ Any lock |
| Guest/Reporter | โ | โ |
๐ก CLI Git Integration (Git LFS)
If you’re using Git LFS (Large File Storage):
# Lock a file via Git CLI
git lfs lock path/to/file.psd
# Unlock
git lfs unlock path/to/file.psd
# View locks
git lfs locks
Code language: PHP (php)
GitLab integrates with Git LFS locking if it’s enabled in the repository.
๐ซ What Locked Files Do Not Do
- โ They donโt prevent read access (just writing).
- โ They donโt encrypt or hide files.
- โ They donโt apply to all files automatically โ you must lock intentionally.
๐ Where It Fits in Workflow
- Integrates well in teams using design review pipelines, game pipelines, or documentation with binary artifacts.
- You might combine it with:
- Branch protection rules
- File-specific approval rules
- Web IDE / VS Code integrations
๐ฆ Summary
| Feature | Details |
|---|---|
| What it does | Prevents edits to non-mergeable files by multiple users |
| Where to find it | Code > Locked Files |
| Who can use it | Developers (own), Maintainers (any) |
| Works best for | Binary assets, media, game files, CAD, design |
| Git integration | Git LFS (git lfs lock/unlock) |
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals