SVN - dealing with trunks, branching, making releases, merging, etc

Since I'm new to Subversion (SVN), and command line calls, here's some sample commands and good practice to branch off a trunk, make changes, merge (dry run), merge, then test, then commit.

For good site on SVN basics:

  • - SVN host url
  • myapp - my application

    copy myapp trunk to branch ABC-123:

    svn cp -m "ABC-123 Branching off trunk"

    You can then work on the branch "ABC-123".

    After you're done, you'll need the revision number.

    So to get branch on your copy:

    svn log --stop-on-copy
    r18132 | kgarcia | 2009-03-24 14:53:10 +0000 (Tue, 24 Mar 2009) | 1 line

    ABC-123 - add this enhancement, and fix other bugs
    [ ABC-123]$ pwd

    To make a release branch "2009-04", copy trunk to branch:

    []$ svn cp -m "Branching off trunk for the April 2009 release"

    Committed revision 18239.

    After you're done and ready to merge back (to main trunk, or release), do a dry-run. This won't merge, but good to get statuses of files like U for updated, A for added, and C for conflict, which is what you'll watch out for.

    If you don't see any conflicts, great. So run the merge to merge the branch you want to merge INTO the checked out copy

    [ 2009-04]$ pwd
    [ 2009-04]$ svn merge --dry-run -r18132:HEAD https://app/svn/myapp/branches/ABC-123

    A home/webmetrics_banner.php
    U home/dsp_home.php
    A images/kj_banner.gif
    U order/secondary/act_step5.php
    U order/karljay/act_step5.php
    U zone/dsp_zonelist.php

    When ready, remove the --dry-run to do the real thing.

    After testing it is good, commit:

    [ 2009-04]$ svn commit -m "ABC-123 Merged to April 2009 release branch"
    Sending home/webmetrics_banner.php
    Sending home/dsp_home.php
    Sending images/kj_banner.gif
    Sending order/secondary/act_step5.php
    Sending order/karljay/act_step5.php
    Sending zone/dsp_zonelist.php
    Transmitting file data ......
    Committed revision 18240.