Logo
Color-Of-Code
  Home   All tags   Terms and Conditions

Svn to Git

December 28, 2018

SVN to GIT

Interesting additional tools

1 use git-svn

  • to clone, a users.txt file is used to map users and avoid metadata if you do not intend anymore to use svn
git svn clone http://my-project.googlecode.com/svn/ \
  --authors-file=users.txt --no-metadata -s my_project

2 Get rid of git-svn-id metadata

  • If you still had git-svn-id metadata inside the commit messages, you can get rid of them using:
git filter-branch -f --msg-filter 'sed -e "/git-svn-id:/d"'

3 Remove empty commits

  • Remove empty commits by setting a default commit message
git filter-branch -f --msg-filter '
read msg
if [ -n "$msg" ] ; then
  echo "$msg"
else
  echo "`<empty commit message>`"
fi'