Starters Guide

  1. Checkout your working copy (checkout)
    $ svn co \
      https://svn.dev.ws/svn/test/trunk
  2. Create your private branch (copy)
    $ svn cp \
      https://svn.dev.ws/svn/test/trunk \
      https://svn.dev.ws/svn/test/branches/private_vnaum
    

    Like any operation that changes repo, copy will require a commit message. Your $EDITOR will be spawned. Enter something meaningful (like "Creating private branch private_vnaum for testing")

  3. Switch your WC to brand new private branch (switch)
    $ svn switch \
      https://svn.dev.ws/svn/test/branches/private_vnaum
    
  4. Add a file (add)
    $ date > QQ
    $ svn add QQ
    A         QQ
    
  5. Change some other file
    $ date >> ZZ
    
  6. Examine working copy state (stat)
    $ svn stat
    A      QQ
    M      ZZ
    

    QQ - locally added, ZZ - locally modified.

  7. Review your changes (diff)
    $ svn diff
    Index: QQ
    ===================================================================
    --- QQ  (revision 0)
    +++ QQ  (revision 0)
    @@ -0,0 +1 @@
    +Thu Jan  4 13:42:28 OMST 2007
    ...
    
  8. Commit your changes (commit)
    $ svn commit
    
  9. Change one more file
    $ date >> QQ
    
  10. Review changes (diff)
    $ svn diff
    
  11. Revert your changes (revert)
    $ svn revert -R .
    
  12. Hard stuff: merging
    1. Find out changeset we're going to apply

      The easies way to do that is to switch to a donor branch and use svn log command. We will merge changes from our private branch - and our working copy already is on that branch.

      Looking at svn log:

      $ svn log --stop-on-copy
      ------------------------------------------------------------------------
      r7 | vnaum | 2007-01-04 14:13:19 +0600 (Thu, 04 Jan 2007) | 2 lines
      
      test edits
      
      ------------------------------------------------------------------------
      r6 | vnaum | 2007-01-04 12:59:31 +0600 (Thu, 04 Jan 2007) | 1 line
      
      Creating private branch
      ------------------------------------------------------------------------
      

      --stop-on-copy will stop log after copy command (branch creation).

      So, we see our changes were from r6 to r7 (r6:7) on branch https://svn.dev.ws/svn/test/branches/private_vnaum (If you forgot what is your current branch - check svn info)

    2. Create recipient branch:
      $ svn cp \
        https://svn.dev.ws/svn/test/trunk \
        https://svn.dev.ws/svn/test/branches/private_vnaum_merge_target
      

      (There were no changes on trunk).

    3. Switch to recipient branch
      $ svn switch \
        https://svn.dev.ws/svn/test/branches/private_vnaum_merge_target
      D  QQ
      U  ZZ
      Updated to revision 10.
      

      Forgot your branch name? svn list can list any directory in repository:

      $ svn list https://svn.dev.ws/svn/test/branches
      private_vnaum/
      private_vnaum_merge_target/
      
    4. Apply changeset:

      To do this we need two things: donor branch name (private_vnaum) and changeset revisions. Changeset is applied to working copy.

      $ svn merge \
        -r 6:7 \
        https://svn.dev.ws/svn/test/branches/private_vnaum
      A  QQ
      U  ZZ
      

      New file added, old file changed.

    5. Commit your changes:
      $ svn commit \
        -m "Merged changeset 6:7 from private_vnaum (test changes)" 

      Commit message must contain changeset description (what revisions and from which branch were merged)!

      It is a good idea to put a summary of changes (will save a lot of time someday).