Skip to content

Instantly share code, notes, and snippets.

@jabley
Created October 5, 2009 20:04
Show Gist options
  • Save jabley/202397 to your computer and use it in GitHub Desktop.
Save jabley/202397 to your computer and use it in GitHub Desktop.
$ cat checkout-git-svn.sh
#!/bin/sh
# Simple script to checkout a project from git and tie up SVN commits. Should be a lot faster than git svn clone
# Initial parameter is the name of the git /svn module. Optional second parameter is the SVN path. This allows us to manage more complex SVN modules, which may be nested rather than at the top level
if [ -z $1 ] ; then
echo "Usage: $0 module-name [svn/path]"
exit 1
fi
module_name=$1
if [ -z $2 ] ; then
svn_path=$module_name
else
svn_path=$2
fi
mkdir $module_name
cd $module_name
git init
git remote add origin git://git.example.com/$module_name.git
git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
git svn -s init svn://svn.example.com/$svn_path
git svn fetch
git checkout -b master -t trunk
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment