Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

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

I want to make changes at say dev.example.com 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 www.example.com, 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
1  
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 repo.example.com for my git repos, which has a hook that pushes updates to beta.example.com. I test from there and sync it over to example.com 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

1 Answer 1

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

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.