How to migrate to git lfs

◇◆丶佛笑我妖孽 提交于 2020-05-28 08:17:26

问题


I have a git repo where many files should be lfs because they are larger than 100M.

Looking around I was unable to find a step by step guide that explain how to migrate a real existing repo with many branches and where lfs files are within subdirectories.

In my case large files are spread around the repo like this:

code/track1/file000.pkl
code/track3/dat000.bin
code/track4/pip000.pkl
code/subcode/track5/pip000.pkl
code/subcode/track5/pop000.model

I suppose to convert the git project into git lfs just using git lfs migrate:

git lfs install
git lfs migrate import --include="*.pkl"
git lfs migrate import --include="*.bin"
git lfs migrate import --include="*.model"
git commit -m "migrating models"

but this does not do anything.

nothing to commit, working tree clean

I want convert all the repo, I mean all the files, the history and also all existing branches.

In other words, git lfs migrate seems to be stable now but not so user frendly.

Running git lfs track "*.pkl" seems to have an effect:

modified:  code/track1/file000.pkl
modified:  code/track4/pip000.pkl
modified:  code/subcode/track5/pip000.pkl

but what to do next. I see that git lfs track will begin tracking a new file or an existing file that is already checked in to your repository.

But what about the history? I'm struggling because I don't want end up with a messed repository that I have to reimport from scratch or where have to deal with filter-branch..

来源:https://stackoverflow.com/questions/61816770/how-to-migrate-to-git-lfs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!