Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
2  
Your project folder is a separate area, not where you're serving your files from (that's github). –  knut Feb 4 '13 at 10:34
1  
Shouldn't it be spelled "separate" (in the title)? (oxforddictionaries.com/definition/english/separate?q=separate) –  Giorgio Feb 4 '13 at 11:50
    
yes, indeed. Thanks. –  xpanta Feb 4 '13 at 12:24
2  
I think you need to clarify what you mean (or maybe what the author of that blog post means) by "separate area". If you mean that the files you're tinkering with should not be the files the user sees when they visit your site, then there's a few good reasons, but a big one is being able to tinker with your code, break it royally, then blow it all away and revert back to the working code without your users knowing anything happened. –  JohnL Feb 4 '13 at 14:35

6 Answers 6

up vote 16 down vote accepted

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.

share|improve this answer
    
thanks. It does clarify things up. While reading that sentence I got the feeling that locally I should have one folder in which to develop, and one folder to keep my files in (was trying hard to correlate with git's "branching" procedure). And in some magical way these two folders would be synced before the files are pushed to github. :-) –  xpanta Feb 4 '13 at 20:41

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".

share|improve this answer
    
+1 for a simple explanation –  Sundeep Feb 4 '13 at 15:48

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.

share|improve this answer
    
Are you saying that all source repositories should be private? –  Brian Marshall Feb 4 '13 at 15:16

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.