Skip to content

Instantly share code, notes, and snippets.

@karlhorky
Last active February 28, 2019 07:42
Show Gist options
  • Save karlhorky/9119641f911eb52a6f26 to your computer and use it in GitHub Desktop.
Save karlhorky/9119641f911eb52a6f26 to your computer and use it in GitHub Desktop.
Migrate existing design git repo to large file storage with history
git filter-branch --prune-empty --tree-filter '
git lfs track "*.ai"
git lfs track "*.psd"
git lfs track "*.eps"
git lfs track "*.jpg"
git lfs track "*.png"
git lfs track "*.svg"
git add .gitattributes
git ls-files -z | xargs -0 git check-attr filter | grep "filter: lfs" | sed -E "s/(.*): filter: lfs/\1/" | tr "\n" "\0" | while read -r -d $'"'\0'"' file; do
echo "Processing ${file}"
git rm -f --cached "${file}"
echo "Adding $file lfs style"
git add "${file}"
done
' --tag-name-filter cat -- --all
@karlhorky
Copy link
Author

@kilianc
Copy link

kilianc commented Oct 22, 2015

Any way you can limit this to a specific branch ?

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