A while back I asked link text and I got some great answers. What I would like to know is if there is a way to keep the files under my web applications document root, and when I make a change, commit them back to the repository.

From what I understand, in order to work on files, they can't be in the web root. Having to move them out to somewhere else just to work on them seems counter-intuitive to me. Am I missing something?


Accepted Answer

in order to work on files, they can't be in the web root

There's no truth to that. Maybe you're thinking of the fact that files which can be modified/edited by the web server shouldn't be under the document root. But as long as you're not using the server itself to do the editing (which would be the case if, say, you created some kind of text editor web application), it's perfectly fine and a completely normal practice to edit files in the document root.

You might be interested in something like my setup: I have the repository which holds my website on the same physical machine as my web server. One working copy is checked out into the web root on that machine, and I have another working copy checked out on my laptop, where I do my development and testing. Now the fun part: I added a hook to the SVN repository so that every time anything is committed to the repository, it automatically updates the working copy in the web root. This way the web root always has the latest revision of the website code, but I can still work on the site without having access to the server.

EDIT: here's the script

Written by David Zaslavsky
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki