→ This results in a huge myproject repository that includes documents and mysqldumps.
Using higher level of URL: W: Ignoring error from SVN, path probably does not exist: (175002): RA layer request failed: REPORT of '/svn/myproject
This error appears, and the clone cannot be completed.
First, clone the repository as is.
git svn clone -s --prefix svn/ http://my-svn-server/svn/myproject/ myproject cd myproject git svn create-ignore git commit -m 'add gitignore'
At this point, take a full copy of the local repository.
cd .. cp -r myproject myproject_work cd myproject_work
Use git filter-branch to keep only the commits for the source code!
git filter-branch --subdirectory-filter source HEAD
Remove unnecessary directories (optional).
rm -rf my-documents rm -rf my-mysqldumps
The repository is now complete. Push it.
git remote add origin my-remote-repo git push origin master
When there are updates to the SVN repository If the SVN repository is updated, perform a git svn rebase in the repository before filter-branch, and then follow the same steps to incorporate the changes into the Git repository.
cd .. rm -rf myproject_work cd myproject git svn rebase cd .. cp -r myproject myproject_work cd myproject_work git filter-branch --subdirectory-filter source HEAD rm -rf my-documents rm -rf my-mysqldumps git remote add origin my-remote-repo git pull origin master git push origin master
Comments