views:

256

answers:

1

I am looking for suggestions for how to structure projects using git repositories and branches.

Assume I want a remote repository, and my project is a website that uses a Flash widget. The Flash widget is compiled from source code that I've written.

To deploy my website, I would like the production server to just be another git client that pulls from the remote repository, but I don't want the source code for the Flash widget to be in my production server's working copy.

I could do this by having a "master" branch that contains both src/ and www/ and a "www" branch that only has "www/". But then my dev team needs to remember to checkin website-related changes to the www branch, and Flash source code changes into master.

So two questions: how does this solution compare to your own projects? And, have you found that in your teams your developers have difficultly keeping track of branches, and accidentally committing and pushing changes that should be in one branch onto another?

+4  A: 

My personal preference is not to keep a copy of the Git repo on the production server. To deploy my web site, I use a deploy script that uses git archive to spit out a "Git-less" copy of the repo, which then gets copied to the production server via SCP. I use Python Fabric for this purpose, but one could also use Ruby's Rake, or something else entirely.

Deploying is a snap -- I just run one command and everything gets copied and set up on the production server.

mipadi
I agree with not pulling directly from the repo. Use a build/deploy machine somewhere to sync the code, run any build elements required, pack it up and deliver it to production.
Andy Hume
That sounds like a good idea, and something to consider. But I'd still be archiving both the src/ and www/ directories in my repo. Do you have separate repos for src and www and the git submodule one in the other for development, or do you use branches?
Jon
I don't have Flash source code, so my situation isn't exactly the same as yours. Using submodules sounds like a good solution, or you could tweak your deploy script to ignore files you don't want to send up to the production server.
mipadi