SVN to Git migration with Git-LFS
Asked Answered
S

1

12

We have a huge SVN repository (~100GB) that we are trying to migrate to Git. Problem is that, the repo contains lots of binary files spread across the folder tree.

First thing that we thought is to move the binaries to Git-LFS, but there's some questions that we need to address before:

  1. We need to keep commit history. Is it possible to replace binary file with LFS file pointer in previous commits?
  2. We are using several branches. During checkout, does git-lfs caches existing binaries so checkout between branches will not involve re-downloading those binaries again and again.
  3. Does Git-LFS support having one binary file across different branches or we should duplicate each binary file for each branch on the server?
  4. Is it possible to do partial checkout of binary files during checkout process? So only some parts of binary files will be downloaded if needed so.
  5. On the server, how should this binary files be stored? Is there a server app needed to store those binaries, or simple HTTP/FTP server will do?

Thanks

Scauper answered 9/8, 2016 at 17:15 Comment(0)
A
3

I think I've found the answer for this, though haven't completed testing it myself (the first step takes many hours for our repository). The trick is from this Atlassian documentation:

https://confluence.atlassian.com/bitbucket/use-bfg-to-migrate-a-repo-to-git-lfs-834233484.html

This is specific to bitbucket, but I imagine it would work with any git repository.

Step 1: First step is to convert the SVN project to git. This can be done with git-svn as described here:

https://john.albin.net/git/convert-subversion-to-git

That page also described ways to carry over the authors and add in the extra details allowed in git authors (real name and email).

Step 2: Now follow the instructions in the above Atlassian documentation to use the "BFG Repo-Cleaner" replace all "big files" in your history with references to git LFS. This is a simpler tool to do some of the things that can also be done with the git-filter-branch tool.

I could give step-by-step instructions here, but I'd just be copying from those other sources, and I haven't actually tried it myself yet (running now). I'll update again when I've seen the results here.

EDIT: I forgot to update this when I'd finished testing almost two years ago, and just noticed now because I got an upvote. From what I remember, I ended using git lfs migrate instead of BFG to migrate large files out of the repo and into git LFS. (https://github.com/git-lfs/git-lfs/wiki/Tutorial)

Acadian answered 10/7, 2017 at 7:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.