Skip to content

Instantly share code, notes, and snippets.

@paulscott
Created December 6, 2019 23:05
Show Gist options
  • Save paulscott/95ddc42ba433ed5d183a57cce630d74f to your computer and use it in GitHub Desktop.
Save paulscott/95ddc42ba433ed5d183a57cce630d74f to your computer and use it in GitHub Desktop.
A script to find files that aren't under git-lfs, but should be
#!/bin/bash
if [ "$#" != "1" ]; then
echo "$0 requires a size argument. ex: 100k."
exit 1
fi
sizeParam="+${1}"
filesOverSize=$( find . -size ${sizeParam} | grep -v /.git | sed 's/^.\///g' )
notInLFS=$({ git ls-files && git lfs ls-files | cut -d' ' -f3-; } | sort | uniq -u )
largeNotInLFS=$({ echo "$filesOverSize" && echo "$notInLFS" ; } | sort | uniq -d )
largeNotInLFSAndNotIgnored=$(echo "$largeNotInLFS" | git check-ignore --stdin --verbose -n | cut -f 2 )
echo "$largeNotInLFSAndNotIgnored"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment