views:

1280

answers:

14

After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question.

What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to understand?

+4  A: 

Version Control is essential to development, even if you're working by yourself because it protects you from yourself. If you make a mistake, it's a simple matter to rollback to a previous version of your code that you know works. This also frees you to explore and experiment with your code because you're free of having to worry about whether what you're doing is reversible or not. There are two major branches of Version Control Systems (VCS), Centralized and Distributed.

Centralized VCS are based on using a central server, where everyone "checks out" a project, works on it, and "commits" their changes back to the server for anybody else to use. The major Centralized VCS are CVS and SVN. Both have been heavily criticized because "merging" "branches" is extremely painful with them. [TODO: write explanation on what branches are and why merging is hard with CVS & SVN]

Distributed VCS let everyone have their own server, where you can "pull" changes from other people and "push" changes to a server. The most common Distributed VCS are Git and Mercurial. [TODO: write more on Distributed VCS]

If you're working on a project I heavily recommend using a distributed VCS. I recommend Git because it's blazingly fast, but is has been criticized as being too hard to use. If you don't mind using a commercial product BitKeeper is supposedly easy to use.

num1
+5  A: 

I would start with:

Then once you have read up on it, download and install SVN, TortoiseSVN and skim the first few chapters of the book and get started.

Yaakov Ellis
+15  A: 

Eric Sink has a good overview of source control. There are also some existing questions here on SO.

Eric Haskins
A: 

Another recent question on the same topic

Yaakov Ellis
+17  A: 

We seem to be in the golden age of version control, with a ton of choices, all of which have their pros and cons.

Here are the ones I see most used:

  • svn - currently the most popular open source?
  • git - very hot since Linus switched to it
  • mercurial - some smart people I know swear by it
  • cvs - the one everybody is switching from
  • perforce - imho, the best features, but it's not open source. The two-user license is free, though.
  • visual sourcesafe - I'm not much in the Microsoft world, so I have no idea about this one, other than people like to rag on it as they rag on everything from Microsoft.
  • sccs - for historical interest we mention this, the great-grandaddy of many of the above
  • rcs - and the grandaddy of many of the above

My recommendation: you're safest with either git, svn or perforce, since a lot of people use them, they are cross platform, have good guis, you can buy books about them, etc.

Dont consider cvs, sccs, rcs, they are antique.

The nice thing is that, since your projects will be relatively small, you will be able to move your code to a new system once you're more experienced and decide you want to work with another system.

Mark Harrison
+1  A: 

If you are working by yourself in a Windows environment, then the single user license for SourceGear's Vault is free.

Chris Miller
+2  A: 

The answer to another question also applies here, most importantly

Jon Works said:
The most important thing about version control is:

JUST START USING IT

His answer goes into more detail, and I don't want to be accused of plaigerism so take a look.

Peter Coulton
+3  A: 

To everyone just starting using version control:

Please do not use git (or hg or bzr) because of the hype

Use git (or hg or bzr) because they are better tools for managing source code than SVN.

I used SVN for a few years at work, and switched over to git 6 months ago. Without learning SVN first I would be totaly lost when it comes to using a DVCS.

For people just starting out with version control:

  • Start by downloading SVN
  • Learn why you need version control
  • Learn how to commit, checkout, branch
  • Learn why merging in SVN is such a pain

Then switch over to a DVCS and learn:

  • How to clone/branch/commit
  • How easy it is to merge your branches back (go branch crazy!)
  • How easy it is to rewrite commit history and keep your branches
    up to date with the main line (git rebase -i, )
  • How to publish your changes so others can benefit

tldr; crowd:

Start with SVN and learn the basics, then graduate to a DVCS.

Jon Works
I don't get this whole "DVCS is harder" meme. In their basic incarnations, hg and bzr are at least as easy to use as svn; in fact, I'd posit that it's *easier* to run `git init` rather than to set up an svn server somehow.
Will Robertson
@Will Robertson: I agree, I never found DVCS more difficult than CVCS. On the contrary, it's been easier to grok. E.g. It's much easier to set up a repo in git while svn has a multiple step process just to follow the convention trunk/branches/tags even if it is locally on your own computer.
Spoike
Hi @Will and @Spoike, I can't say for sure if distributed version control is harder to learn for a new user than centralized is. However, I can compare my transitions from Source Safe to CVS and from there to SVN with my transition from SVN to Bazaar. When you move from one centralized tool to another, they have mostly the same features with a different (hopefully improved) interface. When you move to a distributed tool, there is a fundamental shift in how the repository is used and what your work flow looks like. I found that harder to wrap my head around.
Don Kirkby
+1  A: 

We use and like Mercurial. It follows a distributed model - it eliminates some of the sense of having to "check in" work. Mozilla has moved to Mercurial, which is a good sign that it's not going to go away any time soon. One con, in my opinion, is that there isn't a very good GUI for it. If you're comfortable with the command line, though, it's pretty handy.

Mercurial Documentation Unofficial Manual

pc1oad1etter
The OpenJDK project has also switched and the Python language is in the process of switching to Mercurial.
Martin Geisler
+2  A: 

The simple answer is, do you like Undo buttons? The answer is of course yes, because we as human being make mistakes all the time.

As programmers, its often the case though that it can take several hours of testing, code changes, overwrites, deletions, file moves and renames before we work out the method we are trying to use to fix a problem is entirely the wrong one and the code is more broken than when we started.

As such, Source Control is a massive Undo button to revert the code to an earlier time when the grass was green and the food plentiful. And not only that, because of how source control works, you can still keep a copy of your broken code, in case a few weeks down the line you want to refer to it again and cherry pick any good ideas that did come out of it.

I personally (though it could be called overkill) use a free Single user license version of Source Gear Fortress (which is their Vault source control product with bug tracking features). I find the UI really simple to use, it supports both the checkout > edit > checkin model and the edit > merge > commit model. It can be a little tricky to set up though, requiring you to run a local copy of ISS and SQL server. You might want to try a smaller program, like those recommended by other answers here. See what you like and what you can afford.

Nidonocu
+1  A: 

Mark said:

git - very hot since Linus switched to it

I just want to point out that Linus didn't switch to it, Linus wrote it.

Kevin Ballard
well, he switched from using Bitkeeper to writing and using git.
Craig McQueen
A: 

Just start using source control, no matter what type you use. What you use doesn't matter; it's the use of it that is important

Espenhh
A: 

Like everyone else, SC is really dependant on your needs, your budget, your environment, etc.

At its root, source control is designed to provide a central repository of all your code, and track who did what to it when. There should be a complete history, and you can get products that do full changelogs, auditing, access control, and on and on...

Each product that is out there starts to shine (so to speak) when you start to look at how you want or need to incorporate SC into your environment (whether it's your personal code and documents or a large corporations). And as people use them, they discover that the tool has limitations, so people write new ones. SVN was born out of limitations that the creators saw with CVS. Linus wanted something better for the Linux kernel, so now we have git.

I would say start using one (something like SVN which is very popular and pretty easy to use) and see how it goes. As time progresses you may find that you need some other functionality, or need to interface with other systems, so you may need SourceSafe or another tool.

Source control is always important, and while you can get away with manually re-numbering versions of PSD files or something as you work on them, you're going to forget to run that batch script once or twice, or likely forget which number went with which change. That's where most of these SC tools can help (as long as you check-in/check-out).

Milner
A: 

See also this SO question:

Jakub Narębski