Friday, March 1, 2013


Here are some notes when I play with git-svn:
  • Clone a project. You can run the following commands if the project follows the standard layout with trunk/tags/branches.
      |- ProjectA
      |   |- branches
      |   |- tags
      |   \- trunk
      |- OtherProject
  • Download trunk, tags and branches. You will find the same directories just like SVN repository.
    git svn clone -r XXXX
  • init a new project. This will create dir projectA and initializ it as a git repository.
    git svn init projectA
  • Download trunk only. The directory have the files under trunk only.
    git svn clone -s -r XXXX
    • Provide the revision number using "-r xxxx", otherwise have to wait for a long time until git-svn finishes scanning all revisions.
    • Use the revision of the project (96365) instead of the latest revision (96381). Otherwise, you will get the working directory empty. You can find the revision number in viewvc like this:
      Index of /ProjectA
      Files shown: 0
      Directory revision: 96365 (of 96381)
      Sticky Revision:    
  • Apply git patch to SVN:
    git diff --no-prefix > /tmp/xx.patch
    cd svn-dir/
    patch -p0 < /tmp/xx.patch