BrunoMiranda.com

Personal Blog about Technology, Software Engineering, Design & More

Adding Your Project to Subversion

Posted on May 25, 2007 at 10:14 AM

If you are not yet using source control for your projects you ought to. Subversion is by far my favorite one. Below you will find easy to follow instructions on how to add your project to a subversion source repository.

Create a folder called temp, browse into temp and create your rails application. You will also create tags, branches and trunk folders:

mkdir temp
cd temp
mkdir trunk
mkdir tags
mkdir branches
cd trunk
rails my_app

Now you have to exclude a couple of files from the repository like the files inside tmp/ and log/ as well as the database.yml file.

rm -r log/*
rm -r tmp/* 
mv config/database.yml config/database_example.yml

Your local app is ready to be imported into your subversion repository. Browse to your temp folder and run the import command.

svn import . http://path/to/your/repos/my_app -m "Initial Import"

You have successfully created a subversion repository on the server, now you need to checkout a copy onto you local computer so that you can start working with it.

svn co http://path/to/your/repos/my_app/trunk

You must create a config/database.yml and that is easily accomplished by making a copy of config/database_example.yml. You will also need to tell subversion to ignore that file as well as any new files inside tmp/ and log/.

cp config/database_example.yml config/database.yml
svn propset svn:ignore database.yml config/
svn propset svn:ignore "*" tmp/
svn propset svn:ignore "*" log/

Almost done. All that’s left to do is to commit the above changes.

svn ci -m "Ignoring files."

You are done, just remember that you must add new files to your repository when you create them on your local machine using:

svn add filename.ext
svn ci filename.ext -m "Committing new file."

For more advanced techniques using subversion make sure to check out the free online Subversion Book.

Hierarchy: previous, next

Comments

There are 3 comments on this post. Post yours →


Thanks for the post! I’ve used subversion for awhile, but I’ve always been confused on ignoring files. Thanks for that info.


Short, sweet and useful article. There seems to be small typo in line: mv config/database.tml config/database_example.yml

I think it should be:

mv config/database.yml config/database_example.yml


Thank you. @Navjeet typo has been fixed.

Post a comment

Required fields in bold.

 

Visit the Archives →