Search code examples
gitgit-lfs

How git lfs work ? Do I need to do "git add"?


I can't understand how git lfs works. Do I need to maintain LFS store ? Do I need to do "git lfs track *.dat" every time ? Do I need also do "git add *.dat" every time ?


Solution

    1. Do I need to maintain LFS store?

      No, the LFS store is maintained by the Git server.

    2. Do I need to do git lfs track *.dat every time?

      No, when you execute git lfs track *.dat, a .gitattributes file with the following content is created:

       *.dat filter=lfs diff=lfs merge=lfs -text
      

      From now on every .dat file you create will be stored in the Git LFS. Do not forget to also add/commit/push the .gitattributes file so you never will need to recreate it again, in a case you (or someone else) needs to create the local repository.

    3. Do I need also do git add *.dat every time?

      Yes, the git add command continues to work the same way.

    To learn more about Git LFS and understand the issue it solves, see the What is Git LFS? video.