1

Currently, I'm try to setup git front-end to the Subversion repository.

My Subversion repository is a single large repository which consists of several co-related projects:

svn-root
  |-- project1
  |   |-- branches
  |   |-- tags
  |   `-- trunk
  |-- project2
  |   |-- branches
  |   |-- tags
  |   `-- trunk
  `-- project3
      |-- branches
      |-- tags
      `-- trunk

Because it's sometimes needs to move files between different projects, so I don't want to break the repository to separate ones.

I'm going to use git-svn to setup a git front-end, but I don't see how to exactly mapping the svn to git structure. The two systems treat branches and tags very different and I doubt it is possible.

To simplify the problem, I would just git svn clone the whole root directory and let branches/tags/trunk directories just sit there. But this will definitely result in too many files in branches and tags directories. In Subversion, it's easy to just set the depth of checkout to immediates, which will only checkout the branch/tag titles, without the directory contents. but I don't know if this can be done in git.

The git-svn messed me up. I hope there's more elegant solution.

0

There really isn't a good way to do this. Git does not support partial checkouts. So either you keep it all in one repository and check it all out at once, or you use submodules and keep the file moving to a minimum. See also https://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-repo-to-another-not-a-clone-preserving-history on the latter point.

1

You don't have to checkout the entire history however. The following statement only checks out the most recent changes:

git clone --depth 1 user@server.com:project

Such a checkout is NOT good for editing and checking back in, but it is great for sharing the current code base or for deploying to production, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.