Skip to content

Instantly share code, notes, and snippets.

@thexa4
Forked from karlhorky/migrate-repo-to-lfs.sh
Last active December 18, 2016 22:30
Show Gist options
  • Save thexa4/d2ce19af16b7ebbd81f9b1cddce3756c to your computer and use it in GitHub Desktop.
Save thexa4/d2ce19af16b7ebbd81f9b1cddce3756c 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 "*.bsp"
git lfs track "*.vtf"
git lfs track "*.wav"
git lfs track "*.mp3"
git lfs track "*.mdl"
git lfs track "*.vtx"
git lfs track "*.vvd"
git lfs track "*.phy"
git lfs track "*.bik"
git lfs track "*.tga"
git lfs track "*.otf"
git lfs track "*.ttf"
git lfs track "*.pcf"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment