Last active
December 19, 2015 19:38
-
-
Save holms/6007315 to your computer and use it in GitHub Desktop.
Convert / Migrate svn repository to git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svn co https://server/svn/repo repo-svn | |
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > ../users.txt | |
git svn clone --stdlayout --no-metadata -A users.txt https://server/svn/repo repo-tmp | |
# Note that the "--stdlayout" flag implies you have the common "trunk/branches/tags" svn layout. If your layout differs | |
# become familiar with --tags, --branches, --trunk options | |
cd repo-tmp | |
git svn fetch | |
# skipping branching if interested go here (3rd answer): | |
# http://stackoverflow.com/questions/79165/how-to-migrate-svn-with-history-to-a-new-git-repository | |
cd ../ | |
git clone repo-tmp repo | |
cd repo | |
git remote rm origin | |
# now create central repository on github or your innter system | |
git remote add origin git@github.com:user/myrepo.git | |
git push -u origin master | |
cd ../ && rm -rf repo-tmp repo-svn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment