Subversion (SVN) is one of the most used source control tools for both small and large projects. I am not going to go into the benefits of using Subversion or any source control system in general, instead lets jump right into best practices for organizing your project in Subversion and how it can benefit you, your team, and your project.

Basic Folder Structure

The basic folder structure that is most commonly used for subversion is:

  • trunk: The main branch of your project were the main development takes place
  • tags: The tags folder is where you keep snapshots of your project, most often a release. For example if you release Version 1.1 of your project it is good practice to tag the code at that point so that you can easily rollback to version 1.1 down the road if needed.
  • branches: The branches folder is where you keep experimental code or various versions of the code that are actively used.

The trunk and tags folders are pretty much self explanatory. If you reach a major milestone or release of your project tag the code so that you can easily access that version at a future time. The folder that I find most individuals fail to utilize fully is branches.

The branches folder is meant to keep various version of your project that contain either new functionality or legacy code that are not in the main trunk due to many different reasons. For example if you are working on release 2.1 of the project but you have a team member working on functionality for 2.2 then it would be a good idea to create a branch for the 2.2 project so that any changes those developers working on the new functionality make would not be included in the 2.1 version by accident.

Another use of branches is to branch the code after a release. This way if a bug is found you can easily make the change in the branch for that release and re-release without removing managing changes that occurred in the main trunk since that release. Just remember to include the bug fix in the main trunk as well if applicable.

Subversion is a very powerful but surprisingly easy tool to utilize. If you are still duplicating files and keeping flat versions on your computers or Hard Drives then take a look at subversion it can save you a lot of time and headaches remembering the correct files that you are working on.

, , , ,

Subversion (SVN) is a popular version control system used by developers. Often a developer will find that they have folders or files within their project that they do not want to have saved and versioned. To accomplish this svn provides the ignore property which can be set to tell what not to include.

How to ignore or exclue files of a particular type

Ignoring files of a particular type is accomplished by setting the ignore property to a pattern for a particular url path. Lets assume in our projects we have a log directory and we want to ignore all files of type .log. This would be accomplished by the following command.

svn propset svn:ignore "*.log" log

How to ignore a directory

To exclude a whole directory we would utilize the same format but instead we would use the * pattern as it matches every file. So lets say we have a build folder in our path lets exclude it by the following command.

svn propset svn:ignore "*" build/

Resources

, ,