Subversion Cheatsheet

9 Oct 2007

Subversion Cheatsheet


sudo aptitude install subversion
svnserve -d

Create source project, splitting into trunk, tags and branches (latter 2 directories initially empty).

project is a dummy name that is just used to build repo, so actually use the name project, original is the name of the original code directory.

mkdir -p project/{trunk,tags,branches}
mv ~/original ~/project/trunk

Using trunk/tags/branches for a small project is overkill – tags and branches can be added later. Therefore for a small project, just do:

mkdir -p project
mv ~/original ~/project

Create subversion repository:

svnadmin create svnrepo

Import project into repository, and archive original data:

svn import project file:///home/sonia/svnrepo -m “initial import”
mv project /tmp

After the repo is setup, you’ll probably want to add other directories eg to import projectb:

svn import projectb file:///home/sonia/svnrepo/trunk/projectb -m “initial import”
mv projectb /tmp

Checkout a working copy:

svn checkout file:///home/sonia/svnrepo/trunk original

Make changes to working copy, then get a list of changes:

svn status –show-updates –verbose foo
svn diff

Finally, save changes back to repository:

svn commit

Or, cancel some changes:

svn revert foo

Repository URLS


Get Help

svn help foo

Other Common Tasks

  • ignoring files svn propedit svn:ignore targetdir (see”Ignoring Unversioned Items”)
  • to always ignore files of type x (eg .mp3), edit ~/.subversion/config or /etc/subversion/config and set global-ignores under [miscellany] (see Runtime Configuration Area).
comments powered by Disqus

  « Previous: Next: »