how to import a new project into an svn repository

i always forget the syntax for importing a new directory into svn because i don’t do this frequently. i’ll outline the steps and command lines here, which mostly apply to unix systems.

  1. create the directory which you’ll import. e.g., for an addressbook app. make sure you include a trunk/ subdirectory.

    mkdir -p addressbook/trunk

    if you have any code, copy it into addressbook/trunk/.

  2. now import that into your repository (which in this case is hosted on a machine named build). thusly for the addressbook app:

    svn import addressbook svn://build/addressbook

    this will slurp everything in the addressbook/ directory into svn.

  3. let’s check out the addressbook app from svn to make sure it all imported successfully.

    svn co svn://build/addressbook/trunk

    when it’s done, you should have a trunk/ directory around. inspect the contents of trunk/ to ensure it contains everything you expect. it should.

  4. at this point, you can remove all the original stuff and begin using your svn’d stuff.

    rm -rf addressbook

    mv trunk/ addressbook/

    .

for more information, please check the more authoritative resources are svn help import and the svn manual.


About this entry