views:

768

answers:

18

I am working on a web project, and need to get it into source control. I have looked at svn, git, and a few others, and I will admit that I don't understand at all. The bigger issue is that these seem to keep code in a sort of database and not a real file structure. When we develop we usually do it by making edits and then saving them to the main server to test. My concern is that by having the project in version control it will make this sort of development pattern difficult.

Can anybody reccomend a source control system that gets around this problem, or have a system of webdev that gets around this issue?

+2  A: 

Those systems you mentioned, and pretty much every other system, get around the problem because the problem is actually just imagined... the files may be in a database internally, ON THE SERVER (if it is a centralized system like SVN), but your checkout is actually regular real files that you can manipulate normally.

The benefit this provides is managing change among multiple people, and having access to older versions of any file in the source control.

Mike Stone
+1  A: 

How the source control system stores the data is irrelevant as you shouldn't be attempting to test directly against the assets in the repository.

Instead, the assets are exposed as files which you copy to your development/test environment via the source control system's client.

Steve Morgan
+4  A: 

One way to do this is to set up a complete environment on your development machine that lets you edit code and try it locally. This avoids two obvious problems:

  • You will have a chance to test code before you push it up to the main server
  • Two developers who are editing the same files won't overwrite the other's changes

Once you have a local testing environment, you can set up a source control system where you commit your changes. Only after you have tested your changes and committed them, you can update the main server from source control (via "svn update" or "git pull" or whatever).

Greg Hewgill
+14  A: 

SVN gives excellent source control.

For someone who is new to source control it is well worth having a look at TortoiseSVN - http://tortoisesvn.net. It provides a very straight forward and elegant user interface for SVN.

Above all, never ever even think about using Visual Source Safe!

Joe R
+1: SVN is the easiest to start with among the new. You need to understand the difference between a repository and a workcopy. Please start with http://svnbook.red-bean.com/
van
+3  A: 

To answer effectively, we need to know more details. What sort of "web project" is it? Rails? Enterprisey Java stuff? Static HTML?

One thing is for certain, you need to stop collectively editing the same files on a central server yesterday. Expressing curiosity about version control indicates that you're on the right path, but I can't stress enough how disastrous that paradigm is (to your code, efficiency, and sanity, among other things). "Localhost development" is the key to success with version control.

Daniel Stockman
"'Localhost development' is the key to success..."That's exactly as it should be done...everything else is crazy
Juri
+3  A: 

I'm using git. I love how lightweight it is for everyday development. You can set it up so you can for a git push to push your changes onto another machine, but I do my testing locally and just copy over a tarball when I'm ready.

Andrew Johnson
+2  A: 

If you're doing develoment on a Windows platform there is a very simple two-step process to address your question:

  1. Read this article (read it regardless of what platform you're programing on) http://www.ericsink.com/scm/source_control.html

  2. Download Vault from http://www.source.com. (You may also need to install SQL Server Express -- http://www.microsoft.com/sql/editions/express/default.mspx).

Vault is free for single users. You can install it and be using it within one hour. While you might not settle on Vault, you will quickly appreciate the value of source control.

And, as previously indicated by others, avoid SourceSafe at all costs. If that's your choice, stick with XCOPY.

Full disclaimer: I am in no way affiliated with SourceGear. Just a rabid fan.

rp

rp
+8  A: 

You're right in saying that source control will make your current development pattern more difficult, but that's precisely the goal. There are much better alternatives to the way you're doing it. I would suggest taking a look at some different approaches. We covered one on stackoverflow already. Philip Greenspun has a another approach, and although it's an old post the same principles apply to git and subversion.

The Pragmatic Programmers have some good books on using source control and cover it in a practical way. Once you've spent more time investigating source control in general, I'd suggest looking at how a system like Capistrano can improve your process.

Marcel Levy
+2  A: 

For my money, git is the easiest source-control I've ever used. There is no server to set up like with svn. You just install it and type

git init      //initialize a new repo in the current directory
git add .     //recursively add all files to the index
git commit    //commit the intial state of the project

There is a ton of useful info out there on how to use git. I've found the stuff on kernel.org to be especially useful. The only downside to git currently is that there is a lack of gui stuff for it (a la tortoiseSVN) and windows support is currently a bit strange (although I've had great success using mysysgit)

Paul Wicks
+2  A: 

If you have a Windows server available, then I highly recommend VisualSVN Server for your source control server. Installs very quickly without any black magic and you can do the common administrative work from a console snap-in. You'll have a subversion server, users and a repository available within 15 minutes. There are great subversion clients for any OS. For windows, TortoiseSVN was already mentioned. It integrates very nicely with explorer. If you're using Visual Studio, AnkhSVN integrates with the IDE.

All of the links are free of charge to use, so don't let cost hold you back.

Ben Robbins
+1  A: 

I recommend SVN, and along with it Pragmatic Version Control with Subversion from The Pragmatic Programmers. The book made adopting SVN for me absolutely painless (and a little entertaining). Coincidentally, it also made me a fan of the publishers...but I suppose that's neither here nor there.

Also, I second Greg's comment above about setting up a development environment on your local machine so you don't have to rely on saving changes to your server for testing.

Novaktually
+1  A: 

If you're having trouble using some systems, check out Bazaar. Bzr is very simple to use.

William Keller
+2  A: 

I'll add my vote for Subversion. You can read Version control with Subversion online, for free. Given that you "don't understand at all", jump straight into What is Subversion?

Paul A. Hoadley
+1  A: 

I recommend any distributed VCS like Git. Don't use Subversion or CVS, that technology is obsolete. First time you need to work offline, you would regret such choice. Not to mention ability to have your own branches nobody else needs to know of. Git, Bazaar, Mercurial - it all depends on the operating system you use. If it's mostly Linux, go with Git. Otherwise, test and see what suits you best.

P.S. Yes, I do expect negative votes from SVN fanboys who are too lazy to learn something new.

Milan Babuškov
+1  A: 

If you're a group of people, make sure you're using something everyone is comfortable with. Something that has an interface everyone can use.

Remember that the version control is supposed to make you better, faster, harder and stronger as a team.

The system might provide solutions for people interacting with, but not essentially a part of your team, too.

Would the graphics guys like to have a smooth way of doing version control? Maybe they don't know it themselves yet, but if their desktops and project folders are full of duplicate folders named with arbitrary dates and numbers.. i think they could use a hand. And it would make your life easier too.

When it comes to the fact that everything is kept in a database, and you want to see what you're doing in a development environment somewhere -- look into the hooks system that comes with the vcs you end up with. Essentially you'll want to have a clone/working copy somewhere for a web server to serve, and with every commit you guys push to a central repository, the web server clone will update itself to reflect that.

xkcd150
A: 

Hi,

I am just like you who found all source controls complex.

Use VisualSVN server for the svn server

Use TortoiseSvn for client

Incase you develop using Asp.Net,you can use AnkhSVN.

This is the simplest and best solution.

Josh
+1  A: 

If I understood you correctly you directly edit the files on the server? If that's the case it is pretty dangerous and not really "best practice" I guess. Version control shouldn't affect the way you develop, it's just a tool that should help you do versioning (and backup) of your files. But that works just if you have a local development environment (each developer a separate one) and all of them commit - through version control - to some common repository. The other thing you speak about is a matter of deploying which has nothing to do with version control actually.

Take a look at this post which treats a similar topic: http://stackoverflow.com/questions/1013263/good-practices-for-web-development-project-management/1013414#1013414

Juri
+1  A: 

A method I use a lot is using Subversion, making the main 'htdocs' (or whatever) a checkout of the repository, and then adding a post-commit hook that updates the checkout on each commit.

This has the side-effect of allowing you to maintain version control on the website, while automatically updating your server with the latest changes as people commit them. This makes testing really easy, since you don't have to svn update your server each time you commit something, but you can still roll back if you make any mistakes.

Basically, minimum impact on testing/development lifecycle, maximum gain in code control!

Kazar