Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When cloning an svn repository into git, should I clone only trunk, or the entire repo?

Tags:

git

svn

git-svn

What is the best practice here?

The repository in question is here: http://svn.osqa.net/svnroot/osqa/

like image 844
ripper234 Avatar asked Mar 19 '11 10:03

ripper234


People also ask

How do I clone a SVN repository?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

Can you convert SVN to Git?

The high-level workflow for migrating from SVN to Git is as follows: Prepare a migration environment. Convert the source SVN repository to a local Git repository. (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN.

What does Git SVN clone do?

The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.


2 Answers

I'd clone everything in the first place, just in case you need the other branches later, with:

git svn clone --stdlayout http://svn.osqa.net/svnroot/osqa/

In this case I can't see any particular reason not to, since even with all the branches a git svn clone of the repository only ends up being 11 megabytes. It'll make things easier later if you are interested in the other branches.

like image 113
Mark Longair Avatar answered Sep 28 '22 07:09

Mark Longair


The problem is that subversion branches are exposed (usually, and in your case) via a standard naming convention of TOPLEVEL/branches/.... The way git does it is not so explicit - that is, if you do a git checkout BRANCH_NAME, the branch files are "swapped in" to your current working directory.

With this in mind, I'd suggest only importing trunk, and then importing all the directories in the TOPLEVEL/branches/branchname directory as git branches as you need them.

like image 20
rlotun Avatar answered Sep 28 '22 06:09

rlotun