I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like:
SVN repository in: <
I just wanted to add my contribution to the Git community. I wrote a simple bash script which automates the full import. Unlike other migration tools, this tool relies on native git instead of jGit. This tool also supports repositories with a large revision history and or large blobs. It's available via github:
https://github.com/onepremise/SGMS
This script will convert projects stored in SVN with the following format:
/trunk
/Project1
/Project2
/branches
/Project1
/Project2
/tags
/Project1
/Project2
This scheme is also popular and supported as well:
/Project1
/trunk
/branches
/tags
/Project2
/trunk
/branches
/tags
Each project will get synchronized over by project name:
Ex: ./migration https://svnurl.com/basepath project1
If you wish to convert the full repo over, use the following syntax:
Ex: ./migration https://svnurl.com/basepath .
There are different methods to achieve this goal. I've tried some of them and found really working one with just git and svn installed on Windows OS.
Prerequisites:
svnadmin dump /path/to/repository > repo_name.svn_dump
Steps to achieve final goal (move all repository with history to a git, firstly local git, then remote)
Create empty repository (using console tools or tortoiseSVN) in directory REPO_NAME_FOLDER
cd REPO_NAME_PARENT_FOLDER
, put dumpfile.dump into REPO_NAME_PARENT_FOLDER
svnadmin load REPO_NAME_FOLDER < dumpfile.dump
Wait for this operation, it may be long
This command is silent, so open second cmd window : svnserve -d -R --root REPO_NAME_FOLDER
Why not just use file:///...... ? Cause next command will fail with Unable to open ... to URL:
, thanks to the answer https://stackoverflow.com/a/6300968/4953065
Create new folder SOURCE_GIT_FOLDER
cd SOURCE_GIT_FOLDER
Finally, what do we got?
Lets check our Local repository :
git log
See your previous commits? If yes - okay
So now you have fully functional local git repository with your sources and old svn history. Now, if you want to move it to some server, use the following commands :
git remote add origin https://fullurlpathtoyourrepo/reponame.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
In my case, I've dont need tags command cause my repo dont have tags.
Good luck!
See the official git-svn manpage. In particular, look under "Basic Examples":
Tracking and contributing to an entire Subversion-managed project (complete with a trunk, tags and branches):
# Clone a repo (like git clone):
git svn clone http://svn.foo.org/project -T trunk -b branches -t tags
Several answers here refer to https://github.com/nirvdrum/svn2git, but for large repositories this can be slow. I had a try using https://github.com/svn-all-fast-export/svn2git instead which is a tool with exactly the same name but was used to migrate KDE from SVN to Git.
Slightly more work to set it up but when done the conversion itself for me took minutes where the other script spent hours.
Converting svn submodule/folder 'MyModule' into git with history without tags nor branches.
To retain svn ignore list use the above comments after step 1
This guide on atlassian's website is one of the best I have found:
https://www.atlassian.com/git/migration
This tool - https://bitbucket.org/atlassian/svn-migration-scripts - is also really useful for generating your authors.txt among other things.