Skip to content

Instantly share code, notes, and snippets.

@holms
Last active December 19, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holms/6007315 to your computer and use it in GitHub Desktop.
Save holms/6007315 to your computer and use it in GitHub Desktop.
Convert / Migrate svn repository to git repository
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