Skip to content

Instantly share code, notes, and snippets.

@jabley
Created October 5, 2009 19:59
Show Gist options
  • Save jabley/202391 to your computer and use it in GitHub Desktop.
Save jabley/202391 to your computer and use it in GitHub Desktop.
$ cat svn2git.sh
#! /bin/sh
# Simple script to mirror an existing SVN repository as a git repository.
# Full project history will be imported
#
# Usage:
# svn2git.sh name-of-module
# name-of-module - the name of the GIT repository that we wish to create
# svn/module/path - the optional SVN path of the module being mirrored.
# Defaults to the name of the GIT repository being created
if [ -z $1 ] ; then
echo "Usage: $0 module-name [svn/module/path]"
exit 1
fi
module_name=$1
if [ -z $2 ] ; then
svn_path=$module_name
else
svn_path=$2
fi
mkdir $module_name.git
cd $module_name.git
git --bare init
git --bare svn init -s svn://svn.example.com/$svn_path
git --bare svn fetch --all
git --bare update-server-info
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment