I'm trying to make the move into version control, as my projects are getting larger. Currently my development goes something like this:
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)
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
A version control system (VCS) is a system that tracks changes to a file or set of files over time. The most common type of VCS is a centralized VCS, which uses a server to store all the versions of a file. Developers can check out a file from the server, make changes, and check the file back in.
Version Control Systems allow for more advanced workflows which make working on a large codebase easier. A powerful concept known as “branching” is widely used in the software development industry. Branching is a great way to isolate changes to your code and allows for easy reversing of problematic code.
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:
/web/sites/release-1
/web/sites/release-2
/web/sites/release-3
/web/sites/release-4
/web/sites/stage ==> release-4
/web/sites/live ==> release-3
"stage" and "live" are symbolic links, and are what Apache has for DocumentRoot for virtualhosts 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:
<Directory ~ "\.svn">
Order allow,deny
Deny from all
</Directory>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With