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 ?
            Asked
            
        
        
            Active
            
        
            Viewed 833 times
        
    1
            
            
        - 
                    I've never used GIT Large File Storage, but it seems you have to add `git lfs track *.dat` in `.gitattributes` – Ron van der Heijden Mar 08 '18 at 08:19
- 
                    I know. My question is: Do you I need also do git add file.dat ? git lfs need to do only once time ? @RonvanderHeijden – Mar 08 '18 at 08:50
1 Answers
1
            - Do I need to maintain LFS store? - No, the LFS store is maintained by the Git server. 
- Do I need to do - git lfs track *.datevery time?- No, when you execute - git lfs track *.dat, a- .gitattributesfile 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. 
- Do I need also do - git add *.datevery time?- Yes, the - git addcommand 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.
 
    
    
        Gabriel Staples
        
- 36,492
- 15
- 194
- 265
 
    
    
        Marcelo Ávila de Oliveira
        
- 19,950
- 3
- 39
- 50
- 
                    Can you explain how it works ? I can't understand why need to separate repository to LFS store and bitbucket ? what is goal of idea ? @Marcelo Ávila de Oliveira – Mar 08 '18 at 12:44
- 
                    I updated my answer with a nice video to understand the Git LFS idea. – Marcelo Ávila de Oliveira Mar 08 '18 at 13:34
- 
                    I saw it but i don't understand the main idea. How does it save place ? @Marcelo Ávila de Oliveira – Mar 08 '18 at 13:55
- 
                    When you clone a Git repository you receive all versions of all files. This can be too much time consuming for binary files. The Git LFS enables to keep binary files in a different place, so when you clone a repository Git LFS will manage to you receive just one version of the binary files saving you a lot of time (and resources). – Marcelo Ávila de Oliveira Mar 08 '18 at 14:46
- 
                    The goal of lfs save time of clone only ? what is about of push and pull ? Do I only get pointer to binary file ? @Marcelo Ávila de Oliveira – Mar 08 '18 at 14:50
- 
                    Just in the clone. No, if you have the Git LFS correctly installed you'll receive the real file not the pointer. But again: just the version needed (accordingly with your Git HEAD) not all versions. – Marcelo Ávila de Oliveira Mar 08 '18 at 15:03
- 
                    In simple git I also get needed verstion if I wrote: git clone -b@Marcelo Ávila de Oliveira – Mar 08 '18 at 15:57
- 
                    
- 
                    Very useful video link! I added it to my references in my answer here: [How to use `git lfs` as a basic user: What is the difference between `git lfs fetch`, `git lfs fetch --all`, `git lfs pull`, and `git lfs checkout`?](https://stackoverflow.com/a/72610495/4561887) – Gabriel Staples Nov 21 '22 at 22:33