Skip to content
holzkohlengrill edited this page Dec 15, 2023 · 7 revisions

Git LFS (Large File Support)

So if you want to use git-lfs in your repo, first you need to have a git-lfs client (follow guide: https://github.com/git-lfs/git-lfs/wiki/Installation).

Init setup

Assume you have already a cloned repository and you just need to add lfs support:

git lfs install
git add .gitattributes
git commit -m "Added gitattributes for to git-lfs" .

Add files for LFS support

Suppose you have several "*.bz2" files in "data":

git lfs track "*.bz2"                      # handle bz2 files via git lfs
git rm -r --cached data/*.bz2              # just remove git entries, files will be stored
git add data/*.bz2                         # add again, so that git lfs can catch the files
git commit -m "reconverting done to git lfs" .

Use git-lfs for file locking

Edit and/or create a .gitattributes files (works similar to .gitignore). For .pptx and .ppt files it might look like:

*.ppt* lockable

After that you can manually lock files via:

git lfs lock ./doc/presentation.pptx

# Or use lfs tracking to do that
$ git lfs track "*.ppt*" --lockable        # This will add: `*.ppt* filter=lfs diff=lfs merge=lfs -text lockable` to `.gitattributes`

# Do something with it
# ...

git lfs unlock ./doc/presentation.pptx

For more options see: https://github.com/git-lfs/git-lfs/wiki/File-Locking#managing-locked-files

See who has locked any files:

git lfs locks
Clone this wiki locally