Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

GitLab: What are Locked Files Concept in GitLab?

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 CaseWhy 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 filesVersion control without collisions
Any large binary fileGit can’t merge them cleanly — one editor at a time is safest

🧭 How It Works in GitLab (18.0)

  1. Navigate to Project → Code → Locked Files
  2. Click “Lock a file”
  3. Browse or search for the file you want to lock (must be in the default branch or your working branch)
  4. Once locked:
    • Only the locker can commit changes to that file
    • Others will get a commit error or merge conflict warning
  5. To unlock:
    • The same user (or a Maintainer) can release the lock

🚦 Permission Rules

RoleCan 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

FeatureDetails
What it doesPrevents edits to non-mergeable files by multiple users
Where to find itCode > Locked Files
Who can use itDevelopers (own), Maintainers (any)
Works best forBinary assets, media, game files, CAD, design
Git integrationGit LFS (git lfs lock/unlock)

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x