Migrating from Subversion to Git where repository was not initially using standard layout
I am try to migrate a Subversion repository which was not initially using the standard layout. I cannot figure out how to migrate it.
For Example. In SVN Rev 1. – 700, the layout is
- Why does `git remote` not list anything on my git-svn repo?
- Git SVN fetch nothing occasionally
- Git with SVN trunk and branches
- How to make git-svn act like the keyword expansion of SVN?
- Instructions on using TortoiseGit to interact with an SVN repository?
- Rewrite a merge commit into a squash merge commit
Until the revision 700 then it change to
[svn]/trunk/projectfile [svn]/tags [svn]/branches
How can I run the git svn init command?
Right now when I use
git svn init -s <subversion_repository>
it will show everything in the directory like there are no branches. (same like use below command)
svn checkout <subversion_repository_root>/
2 Solutions collect form web for “Migrating from Subversion to Git where repository was not initially using standard layout”
As I don’t have a subversion repo at hand to try this out with, I can only outline a way of solving this which may or may not work:
- First, make a directory to hold your Git repo and
- Initialize your Git repo:
git svn init svn://path/to/svn/repo
- Inside this repo, run
git svn fetch --revision 1:699(Or whatever the revision range is where you used the non-standard layout)
.git/configand modify the
[svn-remote]section to add/modify the
[svn-remote "svn"] url = svn://path/to/svn/repo fetch = trunk:refs/remotes/trunk branches = branches/*:refs/remotes/* tags = tags/*:refs/remotes/tags/*
git svn fetch --revision 700:HEADto fetch the rest of the repo
- If everything worked until this point, but you don’t have any files in your working directory, run
git svn rebase --localto make sure Git creates the files.
In theory, this should get you a Git repository with the complete history and all the branches and tags intact.
As usual, make backups of anything that might be touched by this before doing any of this stuff, and proceed at your own risk, etc.
As the answer provided, I found that there will be the problem when already fetch all revisions to Git. Create new issue like this topic
After I reviewed the repository, I found that if I provide the parameter (-s) to mark my repository as standard repository, it will ignore for all non-standard, in my case, it will ignore Rev.1-700 and will automatic convert from 700 afterward.
So, right now, I still have no solution except use git-svn with the full fetch from the original url and ignore the path that make the problem occurs.