Working with large binary files in git

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.

  1. Installation of git-lfs
  2. # add packagecloud repo
    curl -s | sudo bash
    # install git-lsf
    sudo apt-get install git-lfs 
    # end enable it
    git lfs install
  3. Marking and commiting binary file
  4. # 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