Skip to content

Instantly share code, notes, and snippets.

@andersonvom
Created June 11, 2012 15:02
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 andersonvom/2910519 to your computer and use it in GitHub Desktop.
Save andersonvom/2910519 to your computer and use it in GitHub Desktop.
Export SVN repo to GIT
SVN_USERNAME="username"
SVN_REPO_URL="http://www.example.com/svn/project"
GIT_REPO_URL="http://www.example.com/git/project.git"
# Exporting default repo configuration
echo "Exporting default repo configuration"
mkdir newrepoA
cd newrepoA
svn2git -v $SVN_REPO_URL --username $SVN_USERNAME > log &
cd ..
# Exporting other folders and files
echo "Exporting other folders and files"
mkdir newrepoB
cd newrepoB
svn2git -v $SVN_REPO_URL --username $SVN_USERNAME --rootistrunk --exclude trunk --exclude branches --exclude tags > log &
cd ..
echo "Waiting for both processes to finish..."
wait
# Merging the two of them together
echo "Merging the two of them together"
cd newrepoA
git config --local user.email "email@example.com"
git config --local user.name "User Name"
git remote add -f otherfiles ../newrepoB
git merge -s ours --no-commit otherfiles/master
git read-tree --prefix=Other/ -u otherfiles/master
git mv Other/* .
git commit -m "Imported and merged files from SVN repository"
rmdir Other
git pull -s subtree otherfiles master
git remote add origin $GIT_REPO_URL
git push --all --tags origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment