Created
June 11, 2012 15:02
-
-
Save andersonvom/2910519 to your computer and use it in GitHub Desktop.
Export SVN repo to GIT
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_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 protected]" | |
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