Git LFS

Sun 27 June 2021

First you need a .gitattibutes files in your repository. This is where the LFS file patterns are stored.

:::sh touch .gitattributes

Now lets start tracking *.gz files as LFS.

git lfs track "*.gz"

This tells git-lfs to track all files matching the .bin pattern. The quotes around the *.bin are there to prevent the shell from expanding *.bin, else you would end up only tracking currently present .bin files of the repository, but not any future added ones.

To see a list of all patterns currently being tracked by git lfs:

git lfs track

To list all LFS files:

git lfs ls-files

To migrate existing repository data to LFS

git lfs migrate import --include="*.gz" --include-ref=refs/heads/master

Category: Git