- Posted: 2nd September 2009
- Created by: Robert
- Found in: SVN (Subversion)
I use subversion for mainly snycronizing websites but it can be used for other applications as well. This article covers a standard workflow using TortoiseSVN, and I also assume SVN has already been setup on your computer or network.
Import the folder into the repository
Basically when creating a new site I would create a folder with the base files I need. Right click on it and then choose Import to save my file into the repository. You would be prompted to choose a directory as to where this folder will be stored, generally I just add the site name as the folder. Eg: http://localhost/new-website/ (for a repository on the local network). After supplying a message I would then click ok to import the new website.
Checkout into a working copy locally
Once the folder has finished Importing, go the folder where the rest of your sites are stored, for instance PHP sites on an apache server are typically stored in C:\wamp\www. Right Click inside the www directory and then select SVN Checkout. Then select the repository tha we just saved in the top input box, and provide where you would like to save a working copy locally to. Eg. C:\wamp\www\new-site. Select ok then you will have a local working copy of the site.
As the name suggests SVN Commit is used to save the changes to any files you choose to keep. The working copy will not include your local changes until you commit your work to the repository! So once you are happy with changes you have made to some files, right click on or inside the root folder of the site and select SVN Commit. Select the files you would like to add/modify/delete from the repository and provide a message as to what your changes were. Click ok to save these changes.
Updating your working copy
It is a good idea that you use SVN Update everytime you come to work on the site to make sure you have the latest working version. If you are the only person using it, then you will not need to worry as much. As said earlier if there are changes locally that aren't committed, then those changes will not be downloaded into another working copy. To update, right click on or inside the root folder of the site and select SVN Update. Then you will have the latest working copy.