Git is great, there is no doubt about that. Being able to revert any changes and recover lost data is simply priceless. But recently, I have started to be concerned about the size of some of my repositories. Some, especially those containing changing binary files, were really large!!!
You can check the size of your repository by simple command:
git count-objects -vH
Here, git Large File Storage (LSF) comes into action. Below, I’ll describe how to install and mark large binary files, so they are not uploaded as a whole, but only relevant chunks of changed binary file is uploaded.
- Installation of git-lfs
- Marking and commiting binary file
# add packagecloud repo curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash # install git-lsf sudo apt-get install git-lfs # end enable it git lfs install
# mark large binary file git lfs track some.file # add, commit & push changes git add some.file git commit -m "some.file as LSF" git push origin master