views:

44

answers:

2

I've been doing LAMP development for roughly ten years now. I've occasionally used CVS and SVN. I code mostly with BBEdit.

I am trying to setup some sort of source control to manage LAMP web apps. I prefer not to have a local repository. I usually have a dev server and a live server. I am looking for a source control option that will work with that. This is largely because I work on multiple machines and don't want to configure PHP, MySQL... on each of them for testing the working copy. Plus I can't test it on other machines if the working copy is on a local machine (without additional legwork.)

What options are out there for this? For SVN, so far I've only been able to figure out how to do a remote repository with a local copy.

Additionally, these are rarely on the same servers with the same users. I've got a half dozen live sites on a half dozen different hosts. Then I have the dev sites on my own server.

Thanks.

A: 

Git works well on OSX. Due to its nature, you will also have a local repository, but this should allow you to manage what you want (local, production and dev repositories). There is indeed a learning curve, but it was worth it, for me.

It depends on the tools you're happy to use and your general work habits, but I don't mind using git from the Terminal and gitk as a tool to visualize the commits in X11. This way, gitk is not fully integrated with the Mac, but it's OK (if you want to, I think there is a flag for the Tcl/Tk compilation to use the native interface rather than X11, but I think there was a bug whereby you couldn't select and copy quickly from the diff window, if that's useful). You can install Git via MacPorts or directly from the source.

Bruno
Is there a way to not have a local copy? Seems like with SVN at least one must have working/dev copy be local.
Forrest
No, there isn't. Why is the local copy such a problem? It's not a bad thing to have your files locally (and a history of their modifications, in this case). The local copy is within the working directory, in a hidden `.git` directory. Would you rather edit the files on the server directly?
Bruno
My issues with a local copy:1. Dev sites are already remote. Rather not change it, but am willing to.2. Using local copies would require me to setup PHP, MySQL... on every box I use. I would have to worry about compatibility issues.3. Some of what I need to edit need domain names. Eg, WordPress. If my dev site was local, I'd have to setup DNS for my local box for each site. Now if I go to edit this on multiple boxes, I'll run into issues.4. Browser testing is MUCH easier when the dev site is remote. I've got ~4 systems I test on.If there's some easier way to go about this, I'm all ears.
Forrest
I'm not sure I understand here. How to you want to edit your files here? I'm not talking of a local working copy for testing, I'm talking of a local copy where you edit the files and then push them to a remote repository on the dev/prod server. You could even push directly to a working repository (non-bare), but that's not necessarily the best/cleanest way.
Bruno
This sounds similar to what Alec suggested as well. I'd prefer to be able to just hit save in whatever app I'm working in, and have the changes be immediately available on the dev server. I'll play with it some more and see if I can get that setup, but it sounds like I'd have to have SVN or Git setup on each server I need to push to.
Forrest
I'm not sure how you do it normally, some editors (perhaps BBEdit) can edit over SSH or FTP semi-transparently, they download the file in a temporary location and upload it on save automatically. If your editor doesn't do that, you could either edit your files on your server directly with an editor there (e.g. using X11, this works out of the box on the Mac) or mount your remote area using MacFuse/sshfs: it would look local. That's independent of version control, though.
Bruno
Thanks Bruno. That's exactly how I edit now. I went back to Versions and tried to figure out some way to make it work with what I want to do, but can't figure it out. Obviously there's a disconnect somewhere. So I'm searching for someone I know to discuss it with since this method of communication doesn't lend itself to easily figuring this out. Thanks for the help.
Forrest
A: 

Just because you have a local repo with your working copy does not mean you have to deploy from the local system.

When changes are complete and checked in locally then push your changes to which ever remote repos you want (including a remote dev repo)and then deploy from there.

Does that work for you?

Alec the Geek
I'll try that and see how it works. I am constantly saving, then hitting reload in a browser... wouldn't want to have to push the changes to the dev server for testing after each save. Thanks.
Forrest
I wonder if the problem is the way you have dev set up to always be deployed from CM. I would look to copy my changes to dev (or have dev pointing to my work files) for unit testing. Then I'd commit and deploy to QA and PROD from CM(CM -> Configuration Management)
Alec the Geek