Bill Garrison
Bill Garrison

Reputation: 2227

Using Git locally with multiple SVN repos making up the application

Okay so here is my issue. My work uses SVN. I want to use Git locally. Seems pretty straightforward with git svn BUT my work threw a little wrench in because they literally use 5 different SVN repo's that go into one complete checkout.

So when I do svn up It literally pulls from 5 different repos. This means that I cannot simply do a git svn clone because each of these 5 repos are needed to create the total application. Now, if I had ANY power to change this I would...but in the mean time would i be able to go into the checked out application and just do a "git init" / "git add ." etc and just trick git into thinking its one giant repo? Then use svn commands to commit when the time comes to commit?

Thanks for your help!

Upvotes: 0

Views: 62

Answers (1)

user849425
user849425

Reputation:

There's no support in git-svn for doing this. You could write a simple bash script to do the commits/rebasing for you, but honestly I recommend doing it by hand in case something goes wrong while updating or committing to the SVN repos.

When I run into this problem I clone the repositories into one directory and then create symlinks between the main project and the external repositories.

That is, let's say I have the structure:

/main-project
  /external-repo-1
  /external-repo-2
  /external-repo-3
  ...etc

I do something like this:

# Create the unified project directory
mkdir LocalProject
cd LocalProject
# Clone the main project
git svn clone svn+ssh://svnserver/main-project
# Find out where all the external repos are
cd main-project
git svn show-externals
cd -
# Clone the sub-repos
git svn clone svn+ssh://svnserver/external-repo-1
git svn clone svn+ssh://svnserver/external-repo-2
git svn clone svn+ssh://svnserver/external-repo-3
...etc
# Create the symlinks
cd main-project
ln -s ../external-repo-1
ln -s ../external-repo-2
ln -s ../external-repo-3
...etc

WARNING: I think this goes without saying, but make sure you don't commit the symlinks to your repo.

Upvotes: 1

Related Questions