
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
Subversion -- Basic Use | ||||||||
| Added: | ||||||||
| > > | (For additional info, see Chapter 2 of the Subversion book.) | |||||||
Initial importInitial import is done with thesvn 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. | ||||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Added: | ||||||||
| > > | Subversion -- Basic UseInitial importInitial import is done with thesvn 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.
$ 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. Checking out a working copyImporting 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.$ 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. Basic workflowOnce 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.$ svn update At revision 198. 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 usesvn status.
$ svn status ? location.txt M potluck.txtThe question mark means there's a new file that Subversion doesn't know about yet. That can be fixed with svn add.
$ svn add location.txt A location.txtIf you're working on textual files (such as text or source code) you can also view the specific changes to a particular file. $ 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 4. Commit the changes.svn commit requires a log message, just like svn import does.
$ 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.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. -- DavidBrodbeck - 25 Oct 2007 | |||||||