Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

implementing version control for webdevelopment

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)

like image 503
Mala Avatar asked Sep 09 '10 16:09

Mala


People also ask

What is website version control?

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.

What is VCS in web development?

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.

Why is version control in web development important?

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.


1 Answers

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>
like image 100
timdev Avatar answered Sep 20 '22 15:09

timdev