Monday, December 6, 2010

recover git-svn clone after it gets interrupted

I keep running into this problem especially when the repo i am cloning is huge or the network is flicky. Before this i had no idea how to pickup the process from where the network problem happened so i use to delete the repo and re-clone the entire thing from the start. But this is a extremely frustrating and waste of time.

Fortunately, this is not necessary; just go into your partially retrieved git-svn repo and execute git-svn fetch. This continues fetching the svn revisions from where you left off.

# git svn clone git://url/project.git
..... connection breaks :(
#move to project directory
# cd project
# git svn fetch
.. fetch continues from where the connection was lost

This works like butter but if you gets a empty directory after git-svn fetch completes. Don't worry, just rebase hard the project

# git rebase --hard

and you are ready to code next generation features in the project you donwloaded ;-)

Cheers,