until now I was using dropbox as my main vcs (it is not, but for a single dev does the job pretty decent).
However I decided to give git a go and see if it fits my needs. Today I was reading this tutorial and at some point it says:
One of the things you should get used to is doing development in a
separate area, not where you’re serving your files from, for obvious
reasons
I am doing development in django, and I can’t find these “obvious reasons”. Why can’t I just use my project’s folder to serve files to github?
I would be happy if someone clarified this for me now that I am new to git.
3
I’m the author of the blog post in question. To clarify, what was meant was not that you shouldn’t use the same directory to “serve files to GitHub”, but rather you shouldn’t do development in the same directory that your web server serves your content from.
Hope that clears things up.
1
This really has nothing to do with Git. It’s a bad idea in general to edit a live website while your users are using it. You should make sure that your edits are complete, then “go live”.
0
You’re not supposed to expose your versioning control files on “published” servers as private information may be gleaned from them that would aid in an attack on your system.
1
The advice to “develop in a separate area” is not specific to git. It’s very popular to have a “development” environment that’s separate from the “production” environment. The production environment (where you serve your files from) is only for code that has been tested and is complete and working.
The development environment is where you do the actual work. Here, you’re free to break things, leave something half-finished and go to bed, try a feature and remove it, take your time working on a large change, roll back to an old version, really just do whatever you want.
And while you’re messing with the development version, breaking it and putting it back together, all the user ever sees is the production version, which should be working properly at all times.
The tutorial is explaining how to set this up quickly with git, but git is not required to use multiple environments, and multiple environments are not required to use git.
I think the meaning is that you should release only stable and working versions, and not every intermediate (maybe broken) version you get when you are working on a new feature.
So you should make sure that whenever someone logs on your website, it should work reasonably well.
This is done by developping in a git repository, and deploying a working versions in the production directory when you are ready to do so.
This tutorial suggests that you use fabric for such deployements. I have never used it, but it is a well know deployement framework, and might be a sane choice in most cases.
You may think that i can guarantee there is no bugs in the codes, caus i am an excellent programer and i make no mistakes.
But the truth is you make mistakes sometime.
If you code in the directory which serving the clients, the clients get unstable service, let’s say one client change his balance in the bank the moment you just modify a py file and make a wrong indent. As a result, the client may get a 500 error, what a urgly page it is.
Doing development in a separate area also guarantee you a runnable project. It also make sense if you doing development under a dev branch instead of a new directory.