SVN to GIT migration - maintaining history when the SVN repo has had a lot of movement

Louis Burton April 9, 2014

I have been following this guide to try and enable us to move to bitbucket:
https://www.atlassian.com/git/migration#!migration-convert<br< a="">>
I have managed to git svn clone our SVN repository that we want to host in bitbucket. I used a command like:

git svn clone --stdlayout --authors-file=authors.txt svn://svnrepo/a/b/project gitproject

Unfortunately though, upon inspection, I notice that the git log (with --follow) does not go further back then the latest SVN repository move for each file. Using an svn client to the SVN log for the same file will track back further.

The history is that the project has evolved and was mavenised, resulting in movement from different locations in the same repository, but outside of the project location we're trying to migrate to GIT. The project has a long history, and movement and restructuring of the repo is to be expected over this time period.

The issue seems very similar to this which I found:
https://github.com/githubtraining/feedback/issues/43<br< a="">>
However his workaround seems unachievable for us due to different parts of our project having moved from different locations at different times (and sometime multiple times), rather than one big bang move to deal with.

Any help with this would be greatly appreciated. I don't want to lose our history and I'd really like to get the clone done properly over the weekend. Thanks in advance.

3 answers

1 accepted

1 vote
Answer accepted
Louis Burton May 21, 2014

In the end, I tried git svn, subgit and reposurgeon. I found similar issues with git svn and subgit. reposurgeon did seem to do more, but it kept hanging for me when removing empty revisions, and the svncutter tool for debugging would also hang.

I managed to accomplish my goal via two different means.
1. Manually grafting together branches. I git svn cloned the main repo, and then I would clone the various locations needed. With each history location I'd potentially rewrite history with filter branch to get them to structure that would join the main clone history nicely. I'd then add them as a remote and fetch them. Then I'd graft all the pieces together and at the end rewrite the full history. This was very labour intensive for our repository as it needed over 40 grafts, picking out references of interest one by one. You could probably do something similar with git replace, but I used grafts.

2. I also managed to get it via a simple git svn clone, but this time cloning the whole root of my svn repo and using a complex regexp in ignore paths to make sure only the paths that history had existed on was included. This took an incredibly long amount of time (like a week), but in the end, it would stitch history together appropriately. I did not include branches or tags, as this seemed to confuse the history.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2014

I think my organization used this tool: http://john.albin.net/git/git-svn-migrate

Louis Burton April 11, 2014

Thanks, I will experiment with this and a couple of alternatives to see if I can maintain this history.

Kumar banerjee April 14, 2020

Can any one share how to use this tool

0 votes
Louis Burton April 10, 2014

I keep turning up other people that have experienced the same problem, but no solution. History is important to any version control system, I keep thinking there must be a way to overcome this that has been found. Again, any direction appreciated.
http://stackoverflow.com/questions/12624520/svn-history-is-lost-in-git

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events