The user that locks a file or directory is the only one that can edit and push their changes back to the repository where the locked objects are located.
The user that locks a file or directory is the only one that can edit and push their changes back to the repository where the locked objects are located.
Read through the documentation on [permissions for File Locking](project/file_lock.md#permissions-on-file-locking) to learn more.
Read through the documentation on [permissions for File Locking](project/file_lock.md#permissions) to learn more.
You can also [view and remove existing locks](#view-and-remove-existing-locks) from the GitLab UI.
NOTE: **Note:**
When you rename an exclusively-locked file, the lock is lost. You'll have to
lock it again to keep it locked.
<!-- TODO: workflow suggestion - don't unlock until the change is in the default
branch. Maybe this can be a follow up on practical workflows.
-->
## Default branch file and directory locks **(PREMIUM)**
## Default branch file and directory locks **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/440) in [GitLab Premium](https://about.gitlab.com/pricing/) 8.9.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/440) in GitLab Enterprise Edition 8.9. Available in [GitLab Premium](https://about.gitlab.com/pricing/).
This process allows you to lock one file at a time through the GitLab UI and
requires access to [GitLab Premium, GitLab.com Silver](https://about.gitlab.com/pricing/), or higher tiers.
Default branch file and directory locks only apply to the default branch set in
Default branch file and directory locks only apply to the default branch set in
the project's settings (usually `master`).
the project's settings (usually `master`).
...
@@ -158,7 +188,7 @@ the project's settings (usually `master`).
...
@@ -158,7 +188,7 @@ the project's settings (usually `master`).
Changes to locked files on the default branch will be blocked, including merge
Changes to locked files on the default branch will be blocked, including merge
requests that modify locked files. Unlock the file to allow changes.
requests that modify locked files. Unlock the file to allow changes.
### Locking and unlocking a file or a directory
### Lock a file or a directory
To lock a file:
To lock a file:
...
@@ -170,12 +200,13 @@ To lock a file:
...
@@ -170,12 +200,13 @@ To lock a file:
An **Unlock** button will be displayed if the file is already locked, and
An **Unlock** button will be displayed if the file is already locked, and
will be disabled if you do not have permission to unlock the file.
will be disabled if you do not have permission to unlock the file.
If you did not lock the file, hovering your cursor over the button will show who
If you did not lock the file, hovering your cursor over the button will show
locked the file.
who locked the file.
### Viewing and remove existing locks
### View and remove existing locks
The **Locked Files**, accessed from **Project > Repository** left menu, lists
The **Locked Files**, accessed from **Project > Repository** left menu, lists
all file and directory locks. Locks can be removed by their author, or any user
all file and directory locks. Locks can be removed by their author, or any user
with Maintainer permissions and above.
with Maintainer permissions and above.
This list shows all the files locked either through LFS or GitLab UI.