I’m trying to make the move into version control, as my projects are getting larger. Currently my development goes something like this:
- I have the “live” version hosted online
- I have a local version, as well as a local webserver
- I edit the local version and do testing on my local webserver
- Finally, I’ll run Unison which updates the live version from my local version (as well as updating my local version with any changes to the live version)
My local platform is Gentoo, Linux. I’ve looked a little into SVN, but I think it might not suit my needs, in that my local webserver (and Unison) would only be able to access currently checked-out code, and so on. I might be wrong, but I don’t know very much about this.
Could someone please walk me through setting up some kind of version control on existing code, which would result in the latest version being accessible to a local webserver and which doesn’t clobber access times for unedited files? (I don’t want Unison uploading every single file every time I make a change)
I use subversion for this, and it works well.
Typically I develop away, until I have something cleaned up for a release.
At that point, I’ll create a branch named something like release-. I’ll hop on the production system and check out my newly created branch. For several projects, I’ll have a staging area that runs on the production system.
For instance, I might have a directory tree that looks like this:
“stage” and “live” are symbolic links, and are what Apache has for DocumentRoot for virtualhosts http://www.example.com and stage.example.com)
This setup allows me to test things pretty carefully in the actual production environment, and then cut over by swapping symlinks.
By branching before deployment, I can make emergency fixes on production in the rare case I need to do so. I can then merge those changes back to the trunk whenever it’s convenient and appropriate.
One last tip: If you use working copies of subversion projects in a production environment, you need to keep apache from allowing people to browse the .svn directories in your project:
in httpd.conf: