File Locking

Better version control for text and binary files.



  • File Locking helps you avoid merge conflicts and better manage your binary files. Lock any file or directory, make your changes, and then unlock it so another member of the team can edit it.

How it works

  • File Locking is included in GitLab Enterprise Edition Premium.
  • Anyone who has push access to a repository can lock a file or a directory.
  • Once a file is locked, anyone else trying to push changes to it will get a pre-receive hook or a notification in the UI that will reject the changes.
  • Teams can view and manage locks directly from the web interface of each of their projects.


  • Pre-receive hooks: Pre-receive hooks block everyone except the author of the file lock from pushing changes to that file.
  • Permission-based: File locking leverages your project permissions to determine who can lock and unlock files.
  • Merge conflict resolution: If you choose not to lock a file and end up with a merge conflict you can easily resolve the conflict from the UI. Preview both versions and select choose the one you want to maintain.


  • Visibility: Locked files help your team understand who is working on the file. In the UI you’ll see who locked the file and when it was locked.
  • Collaboration: Reduce the number of merge conflicts caused by two or more developers working on a file at the same time.
  • Streamline: With Git LFS support and File Locking your team can effectively store and manage their media assets, such as images, PSDs, 3D models, etc. within the repository.

Take GitLab for a spin

See what your team could do with The DevSecOps Platform.

Get free trial

Have a question? We're here to help.

Talk to an expert
Edit this page View source