Koenigsberg
Koenigsberg

Reputation: 1798

Migrate from SVN to a Git repository, where a migration of a part of the same project already took place

Scenario

I am facing a situation where a project X which is versioned via SVN needs to be transferred to a repository A versioned via git.

However something similar was done with X before. Let project X consist of a working tree of three folders: _0, _1, _2. Years ago, a subfolder of _0 was used to create a new git repository via svn2git. Folders _1 and _2 with all their subfolders and contents were in SVN, as they contained a lot of data that wasn't needed to maintain X in A.

However now there is a subfolder of _2 which also needs to be in git repository A. It is still stored in the SVN repository and since the initial migration there have been changes by additional commits.

I am looking into svn2git in order to migrate a subfolder of _2 into A as well, where X already exists. My concern is, if _2 is transferred to a git repository via git2svn and then this git repository is migrated into A, then there is likely to be redundant history. Both _0 and _ 2share a commit history, the history of_0was originally transferred into git, the history of_2` would now be transferred into git, but there is no mapping between these two histories, therefore I expect redundancies.

Question

Can this task be achieved at all? Otherwise I am likely to discontinue these efforts of preserving the history of _2 and just do a clean initial commit.

Currently I see no way to do this without expecting redundant history.

Upvotes: 0

Views: 172

Answers (1)

eftshift0
eftshift0

Reputation: 30212

I think the best you can try is clone the branch that you need now, starting on the last revision that is present on the git repo (I don't know how that could work with svn2git. I know that plain old git-svn supports starting to clone at a randome revision). Then, when you have cloned that branch, you could rebase that branch on top of the original git clone (on the exact equivalent of the revision where we said to start). That could be done by adding a remote to the new git clone so that it can get access to the old git clone. Then rebase the branch, and then feel free to push into a branch of the first git clone.

Upvotes: 1

Related Questions