Git lfs

Notes on git lfs

Git LFS is a Git extension that stores large files outside of your repository while still version controlling them. It replaces large files with text pointers that reference the actual file on a remote server, reducing repository size and improving performance. It’s commonly used for media and binary files that aren’t suitable for traditional Git version control.

Install git lfs on your computer

  1. download git lfs
  2. disable app install security
  3. drag .sh file into terminal and install

Track files

git lfs track *.png (replaces png files with a pointer to remote location)

Migrate old git repo

be careful, this migrate command will also rewrite your history! Your repository history will have different commit hashes and therefore every developer should clone the repository anew after this action git lfs migrate import --include="*.bundle,largefiles/*.bundle" --include-ref=refs/heads/master


  • The local Git LFS cache will not be cleaned up automatically. Just like you have to prune remote branches on a regular basis, you also have to prune your Git LFS content with the following command: git lfs prune
  • To remove lfs from a repo: git lfs uninstall (replaces aliases with the files)

git lfs migrate import –include=”.png,largefiles/.png” –include-ref=refs/heads/master


  • Lfs adds another level of complexity to your repos. Can cause errors if you use ssh and private repos etc. An alternative is to host test files in dedicated repos, and transfer them when needed via networking frameworks etc
  • LFS move your files to a static destination, and leaves a pointer to this destination where your file used to be, which means you cant use your file locally etc