Subversion – is trunk really the best place for the main development


In SVN, trunk is the recommended place for the main development and I use this convention for all of my projects. However, this means that trunk is sometimes unstable, or even broken. This happens for instance when

  • I commit something by mistake
  • When the trunk simply has to be broken because of the way SVN works. Canonical example is file renames – you must commit any file renames first and do any further modifications later; however, file rename may require code refactoring to reflect namespace or class name change so you basically need to commit a single logic operation in two steps. And the build is broken between steps 1 and 2.

I can imagine there would be tools to prevent commiting something by mistake (TeamCity and delayed commits, for instance) but can you really overcome the second problem? If not, wouldn't it be better to do the "wild development" on some branch like /branch/dev and only merge to trunk when the build is reasonably solid?

Best Solution

Your trunk should ALWAYS compile, if you need to make breaking changes you should use a branch and merge the changes back later.

Read this chapter of the SVN book:

Related Question