Subversion Cheat Sheet

(Results appear after the # sign.)

Create Repository

pwd
# /home/dds
svnadmin create repo
chmod -R go+rwX repo/

Create Project Structure

mkdir template
cd template
mkdir myproject
cd myproject/
mkdir trunk tags branches
cd ..
pwd
# /home/dds/template
ls
# myproject

Initial Addition of a Project to the Repository

pwd
# /home/dds/template
svn import . file:///home/dds/repo/ --message 'Initial repository layout'
# Adding         myproject
# Adding         myproject/trunk
# Adding         myproject/branches
# Adding         myproject/tags

# Committed revision 1.
cd ..

Initial Checkout from the Repository

pwd
# /home/dds/
mkdir work
cd work
svn co file:///home/dds/repo/myproject
# A    myproject/trunk
# A    myproject/branches
# A    myproject/tags
# Checked out revision 1.
ls
# myproject

Add a File to the Project

pwd
# /home/dds/work
cd myproject/trunk
echo hi >file.txt
svn add file.txt
# A         file.txt
svn commit --message 'Added file.txt'
# Adding         trunk/file.txt
# Transmitting file data .
# Committed revision 2.

Tag a Release and Create a Branch

svn copy file:///home/dds/repo/myproject/trunk  file:///home/dds/repo/myproject/tags/version-1.0 --message 'Tag version 1.0'
# Committed revision 3.
svn copy file:///home/dds/repo/myproject/trunk  file:///home/dds/repo/myproject/branches/bug-fix-r1.0 --message 'Branch version 1.0 for bug fixes'
# Committed revision 4.

Update with Changes

cd ..
pwd
# /home/dds/work/myproject
svn up
#A    branches/bug-fix-r1.0
#A    tags/version-1.0
#Updated to revision 4.

Commit a Change

echo hello >file.txt
svn up
# At revision 5.
svn commit -m 'Made greeting more formal'
#Sending        trunk/file.txt
#Transmitting file data .
#Committed revision 5.