In-place SVN Import

I discovered an SVN trick today: how to do an in-place import into SVN. Normally when you run “svn import” it will leave the file system alone creating a copy on the repository. Then you have to do an “svn checkout” to pull the files back down under version control.

The import/checkout process normally this is a pain. However there are a few instances where it’s a really big pain such as Unix’s etc/ directory. You can’t just delete etc/ and recheck it out from version control or lots of stuff will break. The other place I’ve found this useful is for Xcode when starting new projects. Use the in-place import instead of Apple’s suggestion of creating two projects.

The process is quite simple. First create an empty directory is the repository, then checkout the empty directory into your existing location. Finally, run add the new files and then commit them into the repository.

svn mkdir https://your-svn-repo.com/new/directory/
 
svn checkout https//your-svn-repo.com/new/directory/  .
 
svn add *
 
svn commit –m “Initial in-place import of directory”

comments powered by Disqus