Skip to content

Instantly share code, notes, and snippets.

@tweakoz
Created December 12, 2019 02:30
Show Gist options
  • Save tweakoz/d689a13d0b5f2f166dcf5162486c130d to your computer and use it in GitHub Desktop.
Save tweakoz/d689a13d0b5f2f166dcf5162486c130d to your computer and use it in GitHub Desktop.
migrate all history to lfs (even if LFS already installed)
# get BFG from https://rtyley.github.io/bfg-repo-cleaner/
# mirror repo (with lfs already installed)
git clone --mirror git@gitserver:<username>/<old-repo-name>.git
cd <old-repo-name>.git
# get local copy of all files already in lfs (from old remote)
git lfs fetch --all origin <master develop all branches you are insterested separated by spaces>
# convert all history
cd ..
java -jar ~/Downloads/bfg-1.13.0.jar --convert-to-git-lfs "*.{png,dds,xgm,blend,ma,mb,psd,tga,tif,dae,gltf,glb,etc..}" --no-blob-protection <old-repo-name>.git
#set up new remote
cd <old-repo-name>.git
vim config # change git@gitserver:<username>/<old-repo-name>.git to git@gitserver:<username>/<new-repo-name>.git
git push --force # this should push modified history using all LFS to git@gitserver:<username>/<new-repo-name>.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment