Using SVN

My notes on how to use subversion from command line.

Assumptions:

Project dir: ~/Projects/myproj
SVN temp layout dir: /tmp/svn
SVN repos: /var/svn/repos

Create repo

mkdir -p /var/svn/repos
svnadmin create --fs-type fsfs /var/svn/repos/myproj

Import project

svn import <local dir> <repo>
mkdir -p /tmp/svn/trunk /tmp/svn/tags /tmp/svn/branches
svn import /tmp/svn file:///var/svn/repos/myproj -m "Initial import" 
svn import ~/Projects/myproj file:///var/svn/repos/myproj/trunk -m "Initial project import"

for local repo – file:/// …
for network repo – http:// …

Check out

svn checkout|co <repo> [working copy]
svn checkout file:///var/svn/repos/myproj ~/Projects/myproj
svn co file:///var/svn/repos/myproj/trunk
# will auto checkout to folder 'myproj' in current dir
# that folder is called 'working copy' dir

Review changes

svn status
# in working copy dir

Add files

svn add <folder|file>

Delete file/folder

svn delete <folder|file>
svn delete file:///var/svn/repos/myproj/trunk/file.txt 
# also can delete file in repo, not only in working copy

Commit

svn commit -m "Log message"
# in working copy dir

Update

svn update (in working copy dir)

Tagging projects

svn copy <repo> <repo tag dir>
svn copy file:///var/svn/repos/myproj/trunk file:///var/svn/repos/myproj/tags/0.1 -m "Version 0.1"

Export (for release)

svn export <repo>
svn export file:///var/svn/repos/myproj/tags/0.1
# will export to folder 'myproj'  in current dir
Share this...
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPin on Pinterest

2 thoughts on “Using SVN”

Leave a Reply

Your email address will not be published. Required fields are marked *