Difference between revisions of "SVN"

From CDOT Wiki
Jump to: navigation, search
(SVN commands)
(SVN commands)
Line 15: Line 15:
 
<pre>
 
<pre>
 
$svn update
 
$svn update
foo.c
+
filename1.c
bar.c
+
filename2.c
 
Updated to revision 2.
 
Updated to revision 2.
 
</pre>
 
</pre>
 
: U <filename> - file was updated (received changes from the server)
 
: U <filename> - file was updated (received changes from the server)
 
*Make changes
 
*Make changes
:<pre>svn add</pre>
+
:<pre>svn add filename1.c</pre>
:<pre>svn delete</pre>
+
:<pre>svn delete filename1.c</pre>
:<pre>svn copy</pre>
+
:<pre>svn copy filename1.c filename2.c</pre>
:<pre>svn move</pre>
+
:<pre>svn move filename1.c filename2.c</pre>
 
*Examine your changes
 
*Examine your changes
:<pre>svn update</pre>
+
:After you've made changes, it's a good idea to take a look at exactly what you've changed before committing them to the repository.
:<pre>svn resolved</pre>
+
:<pre>$svn status</pre>
 +
:This will detact all file and tree changes you've made
 +
 
 +
:By passing a specific path, you will get information about that item alone:
 +
<pre>$svn status stuff/filename3.c
 +
D    stuff/filename3.c
 +
</pre>
 +
:D <filename/directory> - File or directory was deleted from your working copy
 +
:A <filename/directory> - File or directory was added to your working copy
 +
 
 
*Commit your changes
 
*Commit your changes
 
:<pre>svn commit</pre>
 
:<pre>svn commit</pre>

Revision as of 19:10, 22 October 2006

Branch Maintenance

Repository layout:

  • trunk directory - "main line" of development
  • branches directory - branch copies
  • tag directory - tag copies

SVN commands

The typical work cycle will use the following commands:

  • Update your working copy
When working on a project with a team, you'll want to update your working copy to receive changes made by other developers since your last update
$svn update
U  filename1.c
U  filename2.c
Updated to revision 2.
U <filename> - file was updated (received changes from the server)
  • Make changes
svn add filename1.c
svn delete filename1.c
svn copy filename1.c filename2.c
svn move filename1.c filename2.c
  • Examine your changes
After you've made changes, it's a good idea to take a look at exactly what you've changed before committing them to the repository.
$svn status
This will detact all file and tree changes you've made
By passing a specific path, you will get information about that item alone:
$svn status stuff/filename3.c
D    stuff/filename3.c
D <filename/directory> - File or directory was deleted from your working copy
A <filename/directory> - File or directory was added to your working copy
  • Commit your changes
svn commit

More commands

  • Compare changes from one revision to another:
svn diff --revision 1:4 helloworld.cpp
This example allows us to see what's changed between the first and fourth revision of the helloworld.cpp file.
For a complete guide: http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.diff.html