Skip to content

Instantly share code, notes, and snippets.

@stg7
Last active March 30, 2017 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stg7/100aec3407c4a3d6baee00679b6181e5 to your computer and use it in GitHub Desktop.
Save stg7/100aec3407c4a3d6baee00679b6181e5 to your computer and use it in GitHub Desktop.
Porting a svn to git
#!/bin/bash
# please install git-svn
input_svn="url/to/svn/like/for/checkout"
output_git="url/to/git/like/for/cloning"
mkdir -p _svn
mkdir -p _git
svn co "$input_svn" _svn
cd _svn
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
cat authors-transform.txt
if [[ -f "../authors-transform.txt" ]]; then
cp "../authors-transform.txt" .
else
echo "please change authors-transform.txt to authorSVNName = first last <email>"
read
fi
git svn clone "$input_svn" --no-metadata -A authors-transform.txt ../_git
cd ../_git
git remote add origin "$output_git"
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment