Thursday, May 8, 2008

Subversion quick reference

To get HELP on subversion:
  1. svn help <command>
  2. the svn manual is at http://svnbook.red-bean.com/

To REVERT uncommitted changes inside a branch:
  1. cp <file> to another location as a precaution
  2. svn revert <file> or svn revert -R to recursively revert all files

To RESOLVE merge conflicts:

  1. svn status to display C€ in first column for conflicted files
  2. manually fix each file and replace old binary files with new ones
  3. type svn resolved <file>€ for each file or type svn -R resolved€ to resolve all files recursively
  4. svn commit

To CREATE <branch>:

  1. svn copy svn://svn/<repository>/trunk svn://svn//branches/<branch>
  2. <branch> creates within the repository and does not create locally
  3. auto-commit will follow

To CREATE <new branch> from <old branch>:

  1. svn copy svn://svn/<repository>/branches/<old branch> svn://svn/<repository>/branches/<new branch>
  2. <branch> creates within the repository and does not create locally
  3. auto-commit will follow

to DELETE <branch>:

  1. svn delete svn://svn/<repository>/branches/<branch>
  2. <branch> removes within the repository; careful!
  3. auto-commit will follow

To MERGE <branch> to <trunk>:

  1. cd to local copy of <branch>
  2. get the rev. number where the branch was created, or where it was last merged: svn log --stop-on-copy
  3. cd to local copy of <trunk>
  4. make sure it's the latest & greatest: svn update
  5. do the actual merge; plug in <rev> and <branch>: svn merge -r <rev>:HEAD svn://svn/<repository>/branches/<branch>
  6. resolve conflicts
  7. svn commit

To MERGE from <trunk> to <branch>

  1. cd to local copy of <branch>
  2. get the rev. number where <branch> was created: svn log --stop-on-copy
  3. svn merge -r <rev>:HEAD svn://svn/<repository>/trunk <branch>
  4. resolve conflicts
  5. svn commit

To MERGE from <new branch> to <old branch>

  1. cd to local copy of <old branch>
  2. get the rev. number where the old branch was created: svn log --stop-on-copy
  3. cd to local copy of <new branch>
  4. svn merge -r <rev>:HEAD svn://svn/<repository>/branches/<old branch>
  5. resolve conflicts
  6. svn commit

Bill authored this last week for the guys at work.

No comments: