5

I have to use svn as source code management tool, but I want to use git branches locally. I wonder if it works without problems and what's the best approach. I read about 'git svn', but it looks like I would have to sync the whole svn repositoy to use it. That's not an option. Assuming I'm the only developer (not git push/pull between developers) and want to use git only 'locally'. What's the best approach? Just 'git init' on my local checked out project? And to use both tools in the same folder? Are there better approaches?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Achim
  • 15,415
  • 15
  • 80
  • 144
  • 3
    "I read about 'git svn', but it looks like I would have to sync the whole svn repositoy to use it. That's not an option." Why not? The `.git` folder often takes up less space than all the `.svn` folders combined, believe it or not. The worst part is the time spent on the original clone, so you might want to do that during the evening or weekend. If you really don't want to do that though, you can do a "shallow clone" using `-r` as described in this question: http://stackoverflow.com/questions/747075/how-to-git-svn-clone-the-last-n-revisions-from-a-subversion-repository – Tyler Jun 08 '11 at 08:25
  • 2
    And yes, you can use both tools in the same folder. Just make sure you put `.svn/` in your `.gitignore` and put `.git` and `.gitignore` in your `svn:ignore` property, so that the two tools don't show each other's metadata. – Tyler Jun 08 '11 at 08:26

3 Answers3

5

You do not need to sync the whole repository. You can clone the modules you require:

git svn clone --stdlayout http://myrepo/module

That will pull down the whole history for that module. You can just grab HEAD:

git svn clone --stdlayout -r HEAD http://myrepo/module

This is how I work most days.

There are lots of related questions about git-svn workflow... just follow the links to the right of this answer :-)

johnsyweb
  • 136,902
  • 23
  • 188
  • 247
2

Use git svn. You don't have to sync whole repository—you can sync only particular branches and you can skip old history. However, you need to sync all revisions since than on the selected branches. It would be much less useful without that.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
1

You don't have to clone the whole tree, just do a shallow clone. See How to git-svn clone the last n revisions from a Subversion repository?

Community
  • 1
  • 1
J-16 SDiZ
  • 26,473
  • 4
  • 65
  • 84