I am trying to convert a Subversion repository to Git. The problem I am facing is how to preserve the full complete history. The SVN repository has quite convoluted history and then git-svn works, it starts only from particular revision, ignoring all earlier history.
More details: I want to import a project which is now located as per std-layout http://svn.../projects/myProject/trunk
. However the trunk
is not created in SVN as it is now. It was originally created as some custom path like /my_project
, then renamed in SVN into myProject/trunk
, then several more moves and renames and it has finally ended up with standard layout.
So, if I just import the repo as-is pointing to the SVN project folder I need, the git-svn
result starts history from the revision where the standard layout was introduced, ignoring the fact that the projects/myProject/trunk
was moved in the repository multiple times earlier.
Technically I need to import a history of an SVN folder if it was moved/copied into the trunk from some other location (outside the trunk) of the same repository.
Does anybody have any ideas how to recover the history from such repository? Maybe somehow use multiple imports, then git grafts, or some other magic? Is there any easy way?
Same problem here, and I have struggled a lot. Finally, inspired by this question, I summarize following steps to achieve the goal.
git svn reset -r <revision that add layout folders>
/.git/config
, set remote.svn.fetch/branches/tags
to corresponding layoutgit svn fetch -r <revisions in this layout, A:B(included) > [--ignore- path=branches\/]
(Need to delete remote branch reference with same name (if any) in advance, otherwise it skipping the branching step)gitk -- all