Commit fc6e83c2 authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'revise-file-locking-documentation' into 'master'

Refactor file locking docs

See merge request gitlab-org/gitlab!35212
parents 2e5871f3 0f12adfe
...@@ -109,71 +109,7 @@ To remove objects from LFS: ...@@ -109,71 +109,7 @@ To remove objects from LFS:
## File Locking ## File Locking
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/35856) in GitLab 10.5. See the documentation on [File Locking](../../../user/project/file_lock.md).
The first thing to do before using File Locking is to tell Git LFS which
kind of files are lockable. The following command will store PNG files
in LFS and flag them as lockable:
```shell
git lfs track "*.png" --lockable
```
After executing the above command a file named `.gitattributes` will be
created or updated with the following content:
```shell
*.png filter=lfs diff=lfs merge=lfs -text lockable
```
You can also register a file type as lockable without using LFS
(In order to be able to lock/unlock a file you need a remote server that implements the LFS File Locking API),
in order to do that you can edit the `.gitattributes` file manually:
```shell
*.pdf lockable
```
After a file type has been registered as lockable, Git LFS will make
them read-only on the file system automatically. This means you will
need to lock the file before editing it.
### Managing Locked Files
Once you're ready to edit your file you need to lock it first:
```shell
git lfs lock images/banner.png
Locked images/banner.png
```
This will register the file as locked in your name on the server:
```shell
git lfs locks
images/banner.png joe ID:123
```
Once you have pushed your changes, you can unlock the file so others can
also edit it:
```shell
git lfs unlock images/banner.png
```
You can also unlock by ID:
```shell
git lfs unlock --id=123
```
If for some reason you need to unlock a file that was not locked by you,
you can use the `--force` flag as long as you have a `maintainer` access on
the project:
```shell
git lfs unlock --id=123 --force
```
## Troubleshooting ## Troubleshooting
......
...@@ -222,7 +222,7 @@ to learn more. ...@@ -222,7 +222,7 @@ to learn more.
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.
### Confidential Issues permissions ### Confidential Issues permissions
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment