Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 322
Borek Bernard Avatar asked Sep 30 '08 16:09

Borek Bernard


People also ask

What is trunk in Subversion?

The trunk is the main line of development in a SVN repository. A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version.

What is the trunk of a repository?

A project's trunk refers to a project's main development branch in the repository. Generally, developers working on the next main version of a project will be working on the trunk.

Is SVN trunk-based?

Note also that the Subversion team themselves, do not do Trunk-Based Development, despite Subversion have default root directories of 'trunk', 'tags' and 'branches' for newly-created repositories.


1 Answers

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: http://svnbook.red-bean.com/nightly/en/svn.branchmerge.html

like image 54
albertein Avatar answered Oct 01 '22 13:10

albertein