Last active
December 29, 2015 17:19
-
-
Save amercier/7703862 to your computer and use it in GitHub Desktop.
bash <(curl -# -L https://gist.github.com/amercier/7703862/raw)
This file contains hidden or 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
#!/usr/bin/env bash | |
# ============================================================================== | |
# svn-to-git.sh - Migrate a SVN repository to Git | |
# ============================================================================== | |
echo "===============================" | |
echo "Migrate a SVN repository to Git" | |
echo "===============================" | |
echo | |
read -p "SVN source repository (ex: http://my-svn-server/my-project): " | |
SRC="$REPLY" | |
read -p "Destination repository (ex: http://me@my-svn-server/my-project.git: " | |
DEST="$REPLY" | |
NAME="$(echo $DEST | sed -E 's/^.*\/([^\/]+)\.git$/\1/')"; | |
function ask { | |
read -r -p "$1" | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
return 1; | |
else | |
echo "$2" | |
exit | |
fi | |
} | |
echo | |
echo "This will:" | |
echo " 1. Create a local GIT-SVN repository in `pwd`/$NAME-tmp" | |
echo " 2. Migrate SVN repository $PWD into this GIT-SVN repository" | |
echo " 3. Copy the local GIT-SVN repository into a clean Git repository in `pwd`/$NAME" | |
echo " 4. Export the local Git repository to $DEST" | |
echo | |
ask "Continue? [y/N] " "Migration aborted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment