<<

Subversion command-line client – Quick Reference

SUBVERSION QUICK REFERENCE CARD

TYPICAL WORKFLOW • ReReReferringRe ferring to revisions A Tagged snapshot Precede references to a revision(s) with a -r or a - - ››› svn checkout • Checkout / Update working copy revision switch. Alternatively, revision numbers can svn://svn.ssg.uab.edu/qtlbim/pkg/tags/tag_name be suffixed to the url with an ‘@’ symbol. For e.g.: ››› svn co svn://svn.ssg.uab.edu/qtlbim/pkg/trunk Note that the mainline, branches and tags are dif- ››› (or) svn update ››› svn://svn.ssg.uab.edu/qtlbim/pkg/trunk/ -r 851 ferentiated only by the path that you supply. Also, an older revision of any of these can be specified. • Make changes ››› svn://svn.ssg.uab.edu/qtlbim/pkg/trunk/@851 • Update (up) • Review what you did by Revision number Simply use the revision number (e.g. 5). Remember Update to the latest revision ››› svn status (summary output) the revision number applies to the whole project as ››› svn (detailed output) such and not to a file ››› svn update • Review what others did by Keyword Update to a specific revision ››› svn status –u (summary output) Head : Latest revision in the repository ››› svn update –r ››› svn diff –r BASE:HEAD (detailed output) Base : Checked out revision of the working copy Committed : Last revision in which an item changed Update symbols • UpdateUpdate,,,, for latest changes by others Prev : The revision just before ‘ Committed’ 1. A – item Added 2. D – item Deleted ››› svn update by Date 3. U – item Updated • Build package ››› { 2006-06-18 { }2006-11-25 15:30 } 4. G – item merGed successfully 5. C – item in Conflict • Run testtestssss by Range of revisions: • (ci) • Commit with descriptive log message ››› 265:269 PREV:BASE BASE:HEAD ››› svn commit ››› svn commit –m “Log message” Please check the final output message to see if the REPOSITORY TRANSACTIONS commit was successful.

GENERAL INFO • Check out (co) REVIEWING • Getting Help (help) The latest revision • ››› svn help ››› svn checkout Status (st) This gives you information on the command syn- svn://svn.ssg.uab.edu/qtlbim/pkg/trunk Checking for local modifications tax and the various switches that go with it. By far, A specific revision it’s the most useful and handy svn reference. ››› svn status ››› svn checkout • Checking for repository modifications Repository URLs: svn://svn.ssg.uab.edu/qtlbim/pkg/trunk –r REV svn status –u › :/// ››› ›› A Branch ››› svn://svn.ssg.uab.edu/qtlbim/pkg/trunk/ • Diff (di) ››› svn checkout svn://svn.ssg.uab.edu/qtlbim/pkg/branches/branch_na Your changes to working copy me ››› svn diff

1 of 2 Subversion command-line client – Quick Reference Others’ changes to repository Just like with editing file content, these operations • Tag will require a commit before they are reflected in ››› svn diff –r BASE:HEAD the repository. This is because only the ‘safe’ ways ››› svn copy tag_source tag_path/tag_name Changes between two revisions of doing things are listed here. Uses the svn copy command to make a copy of the items that you want to snapshot. Requires a commit ››› svn diff –r REV1:REV2 url • Add to incorporate the tag in the repository. Bring new files / directories under the version con- Changes between working copy and a revision ››› svn checkout(or) svn update to the required revision trol umbrella › svn copy ./pkg/trunk ./pkg/tags/tag_name ››› svn diff –r REV url ›› ››› svn add name(s) Changes between two URLs ››› svn commit svn diff url1 url2 • Delete (rm) Remove files from the latest revision • Log MERGING CHANGES ››› svn delete name(s) Prints commit log messages, author and revision • dates. By default, prints logs till revision in which • Copy (cp) the item was created. Specify revisions / ranges for Merging a bug-fix onto the trunk more specific logs. Refer to the ‘ General Info ’ sec- Copies an item with its previous history. ››› svn checkout / update copy of the trunk tion. ››› svn copy SRC DEST ››› svn merge tag_path/pre_tag tag_path/post_tag • All logs for current directory Move (mv) / Rename (ren) ››› svn commit ››› svn log Moves (renames) an item with its previous history. • Note that both these actions mean the same thing to Revert All logs for current item svn. Hence the commands are just different names ››› svn revert item_name ››› svn log for the same action. Reverts your working copy to the ‘Base’ revision. › svn move SRC TARGET It’s like an undo for all your changes All logs for specified url ›› ››› svn rename SRC TARGET • ››› svn log url Resolved

››› svn resolved item_name All logs just for a branch BRANCHING AND TAGGING Indicates to Subversion that you have resolved a ››› svn log --stop-on-copy branch_url conflict that it had flagged earlier. This removes Subversion treats both branching and tagging iden- locks that were put in place and will permit you to • List ( (ls)ls)ls)ls) tically. It does NOT know the difference between commit your changes that resolve the conflict. the two. This means that the same command is used Browse the repository. Use it like the ls command in unix to create both. The distinction between a branch and a tag is in how YOU treat it. REFERENCES ››› svn ls –r svn://svn.ssg.uab.edu/qtlbim/trunk • Branch 1. http://subversion.tigris.org ››› svn copy branch_source branch_path/branch_name 2. http://svnbook.red-bean.com/ EDITING FILE CONTENT 3. Pragmatic with SVN: (2 nd Uses the svn copy command to create a branch by ed., Pragmatic Bookshelf) Modify file content as you please, as you normally just making a copy of the source revision. This re-

do. Subversion does not affect the way you edit quires a commit for the branch to become part of

code, compile, build etc. the repository. Prepared for the R/qtlbim team, this document is under a Crea- tive Commons Attribution-NonCommercial 2.5 License. Visit ››› svn checkout(or) svn update to the required revision http://creativecommons.org/licenses/by-nc/2.5/ for more info. EDITING DIRECTORY CONTENT ››› svn copy ./pkg/trunk ./pkg/branches/branch_name Authors: Ramprasad Venkataraman, Tapan Mehta @ SSG, UAB ››› svn commit

2 of 2