Keeping track of svn repositories using git

  • Clone an svn repository with entire history.
  • git svn clone --prefix=origin/ svn://svn.dd-wrt.com/DD-WRT
    

    Note: This can be very time-consuming on a large svn repository, esp. when the network connectivity is poor.

  • Clone an svn repository with recent history only.
  • git svn clone --prefix=origin/ -r 28015:HEAD svn://svn.dd-wrt.com/DD-WRT
    

  • When cloning fails on a large repository, keep fetching until it's done.
  • cd DD-WRT
    while ! git svn fetch; do sleep 10; done
    

  • Fetch unfetched commits from the svn repository and rebase current work against it.
  • git svn rebase
    

  • Checkout an older svn revision.
  • git checkout `git svn find-rev r28015`
    

  • Return to the latest revision.
  • git checkout master
    

  • Remove untracked files in the current directory.
  • git clean -n
    git clean -f