1

I have been using git for 2 years now and love it. However, I am doing some work for a company that insist in using svn so I need to port my git way of doing things to svn.

This is what I have learned so far:

svn co https://the.remote.repo
touch myrepo/trunk/mytest.c
svn add myrepo/trunk/mytest.c 
cd myrepo/
svn commit -m "added test file"

which checks out my repo, adds a file, commit it and then pushes it.

I already have a non-svn project (non-git too, it's not under version control yet (awful I know)). How can I turn my existing project into a svn repo ? I can do this:

svn co https://the.remote.repo my_existing_non_svn_directory

which creates a trunk sub-directory in my_existing_non_svn_directory. With git there is no trunk so this would work but with svn, do I have to move all my code into the trunk ? Is there some way round this or is it just an svn thing ?

Many thanks.

ale
  • 11,636
  • 27
  • 92
  • 149
  • 3
    There's no need to stop using git. Use `git-svn` instead. You can keep a local git repository, and `git-svn` will push your changes into svn. – William Pursell Oct 15 '12 at 21:04

2 Answers2

3

With Subversion (unlike Git), you can easily check out a partial tree. So in your first example you might do:

svn co https://the.remote.repo/trunk myrepo

Then you won't have the trunk/tags/branches hierarchy in your working directory, which makes this simpler and faster.

In your second example, if you have a mostly empty Subversion repo (where you have set up the trunk/tags/branches hierarchy), then you can check out https://the.remote/repo/trunk and get an empty directory into which you can add your files.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
1

You can import unversioned tree into repository:

>svn help import
import: Commit an unversioned file or tree into the repository.

svn import my_existing_non_svn_directory https://the.remote.repo/trunk

and work over git-svn with this repo later

Another style

  • svn co empty new trunk
  • copy project-tree into WC
  • add/ignore/commit
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110