Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been used to subversion, so this isn't obvious to me.

Say I have a website at, not currently under source control, which I want to control with git.

I want to make changes at say and commit them when I'm confident they work.

How do people normally do this? I've been doing a bit of reading it seems the normal practice is to create the git repo right there at the root of, then pull to dev. Is that right? Or is it safer, or better practice, to have both www and dev as working trees and the repo at some third place?

share|improve this question
have www & dev as separate branches, work on them & merge the 2 and push when done – Sathya Apr 19 '13 at 5:10
I have for my git repos, which has a hook that pushes updates to I test from there and sync it over to when I have had the ability to test enough to move it over (of course, I have LAMP locally to do work and avoid 500 commits for little things). Is it the best way, not sure - but it has worked well for my uses. I dislike cluttered folders though. – nerdwaller Apr 19 '13 at 5:17

Since git is distributed, you don't necessarily have to have the repo somewhere other than dev or www.

A good practice is to use dev as your working tree, create tags and push those tags to www.

With git, your ideal workflow should be relatively more frequent, smaller commits - you can always rebase to clean up your commit history before pushing it to a central repo / www.

In a larger organization, you would have a 'repo of record' that would be managed by your release engineer(s). For a small / one-person team, then you'll know when you want to push your repo to www.

Do not make www your working tree. All of your changes should come from the repo - this will ensure your production server is always in a known state.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .