Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reinitialize a git-svn repository

Tags:

git

git-svn

Following the advice of this tutorial, I cloned an svn repository which did not have the standard layout.

git-svn clone -s http://example.com/my_subversion_repo local_dir

The -s is there to signify that my Subversion repository has a standard layout (trunk/, branches/, and tags/.) If your repository doesn’t have a standard layout, you can leave that off.

Being completely new to git, I did not realize that simply leaving off the -s option without supplementing the --trunk, --branches, and --tags options would leave me not only with a branchless repository but also with the entire head of the repository checked out (instead of just the head of the trunk).

Is there a way to "fix" my local git repository to behave as though I had created it with knowledge of the svn repository layout? Can I use git-svn init to reinitialize my repository? Because of the length of time involved, I'm hoping to avoid having to reclone from scratch.

like image 515
Bobby Eickhoff Avatar asked Nov 06 '22 17:11

Bobby Eickhoff


1 Answers

This is similar to SO question "Cloning a Non-Standard Svn Repository with Git-Svn", and I am not sure there is a process to fix the Git repo after that initial clone.

The deep clone is the official way:

git svn clone https://svn.myrepos.com/myproject web-self-serve 
   --trunk=trunk --branches=branches/*/*

But I like the encapsulation provided by svn2git.

Unfortunately, both those solutions require re-cloning from scratch...

like image 86
VonC Avatar answered Nov 15 '22 05:11

VonC