List of files not tracked by Git LFS

I am initializing a new Git repo with a huge bunch of files. Repo uses Git LFS . I want to make sure that I tell LFS to keep track of all the files that should be processed before I make my first commit.

I see that git lfs ls-files lists all the files that ARE are tracked by LFS. However (a) I want the opposite: all the files in the repo that are not tracked by LFS (and located in .gitignore ), and (b) this command only works after you commit the files .

Does anyone have git-fu or Ubuntu-fu list all the files in the repo that are not ignored and do not match the track patterns in the various files .gitattribute Git LFS uses


The closest I came is this command, which lists the files in the repo over 100 KB, and then manually scans all the files and hopes that I covered them with a tracking template.

 find . -type f -exec du -Sha -t 100000 {} + 
+5
source share
2 answers

Even if the question is about files that were not committed, let me suggest a solution for the list of files tracked by git, but not git-lfs after commit , which you can do by concatenating the list of files tracked by git ( git ls-files ) with those that are tracked by git-lfs ( git lfs ls-files | cut -d' ' -f3- ) and then only take files that are unique in this list:

 { git ls-files && git lfs ls-files | cut -d' ' -f3-; } | sort | uniq -u 

After that, you can edit the commit ( git rm --cached and git commit --amend ) if you notice a file that sneaked into ...

At the pre-commit stage, following a list of uncommitted files and using git lfs track and git add sequentially, you should be safe.

+4
source

Let me give some ideas:

To get a list of all the files in your repository:

 find . -type f > all.txt 

To list all files that will be tracked by LFS:

 set -f; for f in $(cat .gitattributes | cut -d ' ' -f 1); do find . -name $f; done > lfs.txt 

To list all files that will NOT be tracked by LFS:

 grep -f lfs.txt -F -w -v all.txt > non-lfs.txt 
0
source

Source: https://habr.com/ru/post/1265803/


All Articles