Skip to content

Instantly share code, notes, and snippets.

@sylr
Created March 19, 2010 17:57
Show Gist options
  • Save sylr/337963 to your computer and use it in GitHub Desktop.
Save sylr/337963 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
git svn init svn://<host>/ \
--trunk=<project>/trunk \
--branches=<project>/branches \
--tags=<project>/tags \
project.git
cd project.git
cat .git/config | \
sed s#:refs\/remotes\/trunk#:refs\/heads\/master# | \
sed s#:refs\/remotes\/\\*#:refs\/heads\/*# | \
sed s#:refs\/remotes\/tags\/\\*#:refs\/tags\/*# | \
sed "s#bare = false#bare = true#" > .git/config.tmp
mv .git/config.tmp .git/config
git svn fetch
git svn gc
git gc --aggressive
cp -R .git/* .
rm -rf .git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment