Git Large File Storage

Introduction

Git has a very basic support for binary files, and adding them to a repo is highly discouraged.

If you have binary files you want to commit, you should use Git Large File Storage.

Git LFS will upload your files to Gitlab.com, and will put in the repo only a pointer to the file, avoiding to duplicate data when you edit a file.

Installation

First time you use it in a repo, after you installed it, you have to initialize it:

git lfs install

Useful commands

If you want to track all PDF files, use

git lfs track "*.pdf"

Important

Remember to commit the file .gitattributes, it has metadata for managing binary files

After that, you can using git as usual: git LFS has also some commands similar to the standard ones (git lfs pull, git lfs push), but you usually don’t need them.

If you want to be sure nobody else is editing the same file you are working on, you should use lock functionality

On Gitlab, if a file is tracked by LFS, a badge appears near the file name.