bfg-repo-cleaner
bfg-repo-cleaner copied to clipboard
Tutorials on internet are confusing on git lfs migrations
Tutorials on internet are confusing on git lfs migrations
https://github.com/bozaro/git-lfs-migrate
https://github.com/git-lfs/git-lfs/wiki/Tutorial#migrating-existing-repository-data-to-lfs
https://github.com/git-lfs/git-lfs/issues/1589
Would love to know what is the right way to migrate a pre-existing git repository to use git-lfs to reduce repo size.
Is it to use bfg? or git-lfs-migrate? which one is correct?
Thanks!
According to git-lfs team:
While multiple tools exist, the current recommendation is to use git-lfs-migrate as BFG writes .gitattributes files incorrectly if you're updating multiple file types.
That said, #156 removed the temptation to mention multiple file-types. You may still find issues with the way BFG wants to create .gitattributes
files - if you main goal is LFS conversion, you might want to see if git-lfs-migrate
meets your goals first.
What's worse, Atlassian is recommending BFG to migrate LFS files:
https://confluence.atlassian.com/bitbucket/use-bfg-to-migrate-a-repo-to-git-lfs-834233484.html
In 2019, it still seems like BFG is not recommended. But there is a lot of stale information out there, and this project doesn't really do a great job at consolidating information and being the authority for what is right vs wrong, and recommended.
I have been through all the links here trying to figure out whether to use BFG or git-lfs migrate. My use case worked using git-lfs migrate. However, as stated above it was very confusing figuring out how and which tool to use.
I got a little bit of confusion on the step of migration. Here's what I thought:
- git clone the repo with larger binary files.
- do the git-lfs-migration import …
- git lfs install
- add .gitattribute and .lfsconfig
- git push
Does it sound right?
I might be wrong, but it seems LFS is the way to go as per new repos/commits. BFG is useful when you have to clean your history.
That said, they to do not seem equivalent in result. BFG deletes files (you should have a backup?), and LFS treats them separately only. So maybe thats why BFG has the option --convert-to-git-lfs (clean history but in LFS way).
I'm still learning also, please correct me if I'm wrong.