How to set up Subversion version control for a Rails project

Here is how to set up version control for a Rails project using
Subversion. I just spent 4 hours and maybe you can do it in 20 minutes
with these instructions.

I assume your situation is:
You are setting up version control on a new subdirectory on your
computer.
You will copy your entire rails project directory tree into the new
subdirectory after you get subversion running.
With subversion, you are always working on a COPY of your project
subdirectory. Once under subversion, you only edit the copy.
You are running Linux, like Ubuntu or Fedora
You will store your repository on your local computer.

Here is the subversion online book:

http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.preface.organization

Monkey see, monkey do example of simple svn setup for a single user
keeping a repository of a single subdirectory development project called
“weedy”, showing use of “add *” to suck up stuff as it is created.

Get subversion using your package manager, like on Ubuntu:
sudo apt-get install subversion; use rpm for Red Hat type distros

verify svn --version

These examples are for a project subdirectory called “weedy” change for
your need. Be sure to create branches, tags and trunk.

username-$ mkdir /home/username/repository
username~$ svnadmin create /home/username/repository
username~$ mkdir weedy/branches
username~$ mkdir weedy/tags
username~$ mkdir weedy/trunk
username~$ svn import /home/username/weedy

svn uses “url type names”, here this “file:///” is just a local file

file:///home/username/repository/weedy -m “initial import”
Adding /home/username/weedy/trunk
Adding /home/username/weedy/branches
Adding /home/username/weedy/tags

Committed revision 1.
username~$ mkdir work
username~$ cd work
“svn co” means “svn check out a copy from the repository”
username~/work$ svn co file:///home/username/repository/weedy
A weedy/trunk
A weedy/branches
A weedy/tags
Checked out revision 1.
username~/work$ ls
weedy
Now do all your editing on THIS COPY, like add all items from existing
project by copying.
username~/work$ cd weedy/
username~/work/weedy$ touch test.txt
You have to tell svn to add any items that you have brought into the
work area or created. Next command adds test.txt for version control.
username~/work/weedy$ svn add *
Next command sends changes you made back to the Repository:
username~/work/weedy$ svn update

On Thu, 2006-10-12 at 14:27 -0700, Lee McKusick wrote:

subdirectory. Once under subversion, you only edit the copy.
“weedy”, showing use of “add *” to suck up stuff as it is created.
username~$ svnadmin create /home/username/repository
Adding /home/username/weedy/tags
username~/work$ ls
weedy
Now do all your editing on THIS COPY, like add all items from existing
project by copying.
username~/work$ cd weedy/
username~/work/weedy$ touch test.txt
You have to tell svn to add any items that you have brought into the
work area or created. Next command adds test.txt for version control.
username~/work/weedy$ svn add *
Next command sends changes you made back to the Repository:
username~/work/weedy$ svn update


I think you meant for this last line to be:

svn commit --comments=“Your comments for the commit go here”

as svn update would not send changes back the repository but svn commit
would.

Also as a reference…

http://blog.teksol.info/articles/2006/03/09/subversion-primer-for-rails-projects

Craig