Skip to content

Instantly share code, notes, and snippets.

@codedeep79
Last active October 31, 2022 01:06
Show Gist options
  • Select an option

  • Save codedeep79/75e406886c6273b858ee1190b97679bb to your computer and use it in GitHub Desktop.

Select an option

Save codedeep79/75e406886c6273b858ee1190b97679bb to your computer and use it in GitHub Desktop.
Git LFS syntax for tracking folder

Find all the files extensions using following command

find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u  

and then creating a .gitattribute file and adding git lfs track syntax. This command generates that for you, it tracks all the files and its extensions and creates lfs tracking syntax.

find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u | awk '{print $1" filter=lfs diff=lfs merge=lfs -text"}' | sed 's/^/*./'

Write output to the .gitattribute file in folders, subfolders and commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment