bfg-repo-cleaner icon indicating copy to clipboard operation
bfg-repo-cleaner copied to clipboard

Tutorials on internet are confusing on git lfs migrations

Open rlam3 opened this issue 8 years ago • 5 comments

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!

rlam3 avatar Jan 30 '17 21:01 rlam3

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.

javabrett avatar Jan 31 '17 01:01 javabrett

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.

rcdailey avatar Mar 20 '19 16:03 rcdailey

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.

RogueRaider avatar Jul 17 '19 23:07 RogueRaider

I got a little bit of confusion on the step of migration. Here's what I thought:

  1. git clone the repo with larger binary files.
  2. do the git-lfs-migration import …
  3. git lfs install
  4. add .gitattribute and .lfsconfig
  5. git push

Does it sound right?

ieng-lao avatar Jan 22 '20 01:01 ieng-lao

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.

bernardoadc avatar Jan 20 '21 22:01 bernardoadc