---+ Subversion -- Basic Use (For additional info, see [[http://svnbook.red-bean.com/nightly/en/svn.tour.html][Chapter 2 of the Subversion book]] and the [[http://subversion.tigris.org/files/documents/15/177/svn-ref.ps][Subversion Quick Reference Card (PostScript)]].) ---++ Initial import Initial import is done with the =svn import= command. It takes two arguments -- a source directory, and a destination URL. You can also supply a log message with =-m=. The message is mandatory -- if you don't provide one, your default editor will be started so you can compose one. <verbatim> $ svn import svn-demo svn://lemur.ling.washington.edu/test/svn-demo/trunk -m "Initial import of sample Subversion project." Adding svn-demo/party Adding svn-demo/party/potluck.txt Adding svn-demo/party/pizza-toppings.txt Committed revision 198. </verbatim> ---++ Checking out a working copy Importing a directory does not automatically make it a working copy under version control. To do that, it's necessary to check it out, just like you would with someone else's project. <verbatim> $ svn checkout svn://lemur.ling.washington.edu/test/svn-demo/trunk A trunk/party A trunk/party/potluck.txt A trunk/party/pizza-toppings.txt Checked out revision 198. </verbatim> ---++ Basic workflow Once you've got a project under version control, day-to-day use follows a simple pattern. ---+++ 1. Make sure you're up to date. This can be skipped if you're working on your own private project. If you're collaborating with others, however, it's best to make sure you have the most recent revision before you start editing files. <verbatim> $ svn update At revision 198. </verbatim> ---+++ 2. Make your changes. Edit files as you normally would. ---+++ 3. View the status of your files, and fix any problems. To see what changes you've made, you can use =svn status=. <verbatim> $ svn status ? location.txt M potluck.txt </verbatim> The question mark means there's a new file that Subversion doesn't know about yet. That can be fixed with =svn add=. <verbatim> $ svn add location.txt A location.txt </verbatim> If you're working on textual files (such as text or source code) you can also view the specific changes to a particular file. <verbatim> $ svn diff potluck.txt Index: potluck.txt =================================================================== --- potluck.txt (revision 198) +++ potluck.txt (working copy) @@ -3,3 +3,4 @@ Alice - Salad Earl - Scalloped potatoes Sue - Jell-O +David - Chocolate cherry cake </verbatim> ---+++ 4. Commit the changes. =svn commit= requires a log message, just like =svn import= does. <verbatim> $ svn commit -m "potluck.txt: Add another dish to pass; location.txt: Add new file for party location." Adding party/location.txt Sending party/potluck.txt Transmitting file data .. Committed revision 199. </verbatim> *Note:* Revision numbers will not always be consecutive. They're global for the entire repository, so commits to other projects will increment the version number you see. -- Main.DavidBrodbeck - 02 Feb 2009
ore topic actions
Topic revision: r3 - 2009-02-02 - 19:57:46 - brodbd
Create New Topic
Copyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Terms & Conditions