Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN to Git migration with Git-LFS

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

like image 450
user6696847 Avatar asked Aug 09 '16 17:08

user6696847


People also ask

Can you convert svn to Git?

The high-level workflow for migrating from SVN to Git is as follows: Prepare a migration environment. Convert the source SVN repository to a local Git repository. (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN.

Which migration is actually recommended for migration from svn to Git?

Migrate from SVN to Git with History and Branches txt file to match the syntax you need for your Git author information. Now that you have your list of authors ready, you can run the import using git svn and specify the authors-transform. txt . Copy the authors-transform.


1 Answers

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)

like image 95
Svend Hansen Avatar answered Sep 17 '22 04:09

Svend Hansen