Aug
05
2007

Subversion – Subdirectory Branch and Merge

While rereading the SVN Book, I noticed instructions for creating a branch on a subdirectory of the trunk. So I decided to create a branch on just the php subdirectory of a project:

svn copy http://localhost/svn/ll/trunk/php http://localhost/svn/ll/branches/phpMVC

The branch development was adopted, thus requiring merging the code back into the trunk. Overall, using a branch on just the subdirectory I was working on made the development and merging easier. Commits by others could be retrieved by an update without needing a merge, minimizing disruptions during coding.

I screwed up the merge as follows:

  • svn merge -r 11:15 http:../branches/phpMVC – on the basis of a stop-on-copy command that started at 15 and ended at 11.  But other files in the branch had been modified up to revision 20.  So I will use the form svn merge -r 11:HEAD from now on.
  • I kept issuing the svn merge and svn switch  commands in the root directory instead of the php subdirectory.  These missteps were reported by SVN and I recovered, but I did scare myself a few times.

Also, I modified a file in a css subdirectory which I could not commit to the branch because it was not within the scope of the branch. Next time I will create the branch on the entire project and then svn switch only the subdirectory I’m working on. This leaves the option of switching other subdirectories if the work expands.

posted in Subversion by Bozzie

 
Powered by Wordpress and MySQL. Theme by openark.org