wiki:SubVersion/QuickStart
Last modified 4 years ago Last modified on 05/18/10 15:38:03

Quick-Start

1. Create the repository

svnadmin create ''<path>''

Example (Creates a repository called 'example' inside the dir '~/svn'):

svnadmin create ~/svn/example/

2. Import of existing files

mkdir $TMPDIR/example            # create temp. dir
cd $TMPDIR/example               # change to it 
mkdir trunk branches tags        # create subdirs 'trunk', 'branches', 'tags'
mv ''<Old project path>''/* trunk/     # move all existing project file to 'trunk'
svn import -m "Initial import" . file://''<path>''/  # import all this

Example:

svn import -m "Initial import" . file://$HOME/svn/example/

3. Check out the current version

cd ''<parent directory of working directory>''
svn co file://''<path>''/trunk/ ''<working dir name>''

Example:

cd ~/tmp
svn co file://$HOME/svn/example/trunk/ example

Instead of 'co' you can also write 'checkout'.

4. Edit working directory

Edit your project files like you want. See below how to add, remove, move or copy files. (In general just put an 'svn' before)

5. Check in the modified version

Inside the working directory:

svn ci [-m "log message"]

Instead of 'ci' you can also write 'commit'.

Other commands

Updating

Because one of your co-workers might have made changes to the project while you were busy with your working copy you should update it from time to time to get aware of this changes. Collisions in files (two people changed a file at the same place) will be displayed without overwritting your changes.

svn up

Instead of 'up' you can also write 'update'.

View status

Show the modifications and changes in your working copy. This uses local copies of the originals which are located in an hidden subdir '.svn'. To display also changes made to the repository (from an other person) use the '-u' option.

svn st [-u]

Instead of 'st' you can also write 'stat' or 'status'.

View log entries

svn log ''<files>''

Add files

svn add ''<files>''

Remove files

svn rm ''<files>''

Move files inside the working dir

svn move ''<from>'' ''<to>''

Copy files inside the working dir

svn copy ''<from>'' ''<to>''