views:

390

answers:

5

I've never really worked with a lot of people where we had to check out code and have repositories of old code, etc. I'm not sure I even know what these terms mean. If I want to to start a new project that involves more then myself that tracks all the code changes, does "check out" (again, don't know what that means), how do I get started? Is that what SVN is for? Something else? Do I download a program that keeps up with the code?

What do I do?

It will all be in house. No Internet for storing code.

Thank you.

EDIT: I don't even know if what I am asking for is called source control. I see things about checking out, SVN, source control, and so on. I don't know if it is all talking about the same thing or not. I was hoping to use something open source.

+18  A: 

Check out Eric Sink's excellent series of articles:

Source Control HOWTO

Gulzar
Upvote for (unintentional?) pun
Anthony Rizk
yeah it was unintentional. :)...but again..
Gulzar
Looks promising so far. I hope it will provide an open source solution instead of the product he sells. Thank you (everyone).
johnny
there are plenty open source solutions for source revision control (CVS, Subversion, GIT, etc...). Eric's articles are great resources for what it is, which is where you are starting.
kenny
His product is also free for single developer use AFAIR...
Lucero
+1  A: 

Are you creating the project that requires source control? If so, choose a Source Control system that meets your needs, and read the documentation for how to get it set up. If you are simply using a previously set up Source Control system for an existing project, ask a coworker who has been using it, or ask the person who set up the Source Control system.

For choosing a Source Control system that meets your needs, most Source Control systems have extensive descriptions of their features online, many provide evaluation or even completely free products, and there are many many many anecdotal descriptions of what working with each individual Source Control system is like, which can help.

Just don't use Microsoft Source Safe if you value your sanity and your code.

McWafflestix
Bear in mind that you can get excellent VCS tools for free, that are fairly easy to set up. The only reason for using one that's less than excellent is if it's already installed and in use.
David Thornley
About the only files that you'd want an exclusive lock on these days are binary files (e.g., database files or bitmaps); and most SCMs these days will automatically do an exclusive lock on file types that they treat as binaries and a non-exclusive lock on other file types. Most SCMs these days have decent merge facilities for text based files for those cases where two or more devs have the same file locked and one wants to check it back in after another has checked his/her changes in.
RobH
+1  A: 

I recommend Git and Subversion (SVN) both as free, open-source version control systems that work very well. Git has some nice features given that it can be easier to work decentralized.

Scott Anderson
If I check out my code from Subversion, I certainly don't get exclusive access to anything.
anon
That's one meaning of "check out", but it's getting increasingly old-fashioned. The more common meaning is that you get a copy of everything you need, regardless of what anybody else has. Modern VCSes are not designed to work with exclusive access, although some of them have some provision for it.
David Thornley
Why wouuld they move from what he put? It sounds good to have exclusive control How else would you keep from writing over each other? (just trying to understand.)
johnny
See the link in my answer for why non-exclusive control works. In practice, I have found it much more productive. Sometimes you spend time fixing a conflict, but much less time than you spend waiting around for someone to release a file. Especially when they went on vacation for two weeks and forget to release all their locks, or even worse, couldn't because they were in the middle of a difficult change that couldn't go back into the code, they couldn't lose, and making a copy was too much of a hassle.
Yishai
Not to mention that breaking locks is trivial in Subversion: "svn unlock --force foo.html".
John Feminella
+7  A: 

So, a long time ago, in the bad old days of yore, source control used a library metaphor. If you wanted to edit a file, the only way to avoid conflicts was to make sure that you were the ONLY one editing the file. What you'd do is ask the source control system to "check out" that file, indicating that you were editing it and nobody else was allowed to edit it until you made your changes and the file was "checked in". If you needed to make a change to a checked out file, you had to go find that freakin' developer who'd had everythingImportant.conf checked out since last Tuesday..freakin' Bill...

Anyway, source control doesn't really work like that anymore, but the language stuck with us. Nowadays, "checking out" code means downloading a copy of the code from the code repository. The files will appear in a local directory, allowing you to use them, compile the code, and even make changes to the source that you could perhaps upload back to the repository later, should you need to. Even better, with just a single command, you can get all the changes that have been made by other developers since the last time you downloaded the code. Good stuff.

There are several major source control libraries, of which SVN (also called Subversion) is one (CVS, Git, HG, Perforce, ClearCase, etc are others). I recommend starting with SVN, Git, or HG, since they're all free and all have excellent documentation.

You might want to start using source control even if you're the only developer. There's nothing worse than realizing that last night the thousand lines of code you deleted as useless were actually critically important and are now lost forever. Source control allows you to zoom forwards and backwards in the history of your files, letting you easily recover stuff that you should not have removed, and giving you a lot more confidence about deleting useless stuff. Plus, fiddling around with it on your own is good practice.

Being comfortable with source/revision control software is a critical job skill of any serious software engineer. Mastering it will effectively level you up as a professional developer. Coming onto a project and finding that the team keeps all their source in a folder somewhere is an awful experience. Good luck! You're already on the right path just by being interested!

CaptainAwesomePants
Very nice sense of story telling!
Lakshman Prasad
+2  A: 

Checkout means retrieving a file from a source control system. A source control system is a database (some, like CVS, use just specially marked up text files, but a file system is also a database) that holds all versions of your code (that are checked in after you make modifications).

Microsoft Source Safe uses a very proprietary database which is prone to corruption if it is not regularly maintained and uses reserved checkouts exclusively. Don't use it, for all those reasons.

The difference between a reserved checkout and an unreserved checkout is in an unreserved checkout, two people can be modifying the same file at once. The first one to check in gets in no problem, and the second one has to update their code to the latest version and merge the changes into theirs (which usually happens automatically, but if the same area of the file was changed, then there is a conflict, which has to be resolved before it can be checked in).

For some arguments for unreserved checkouts, see here.

Following this, you will be looking at a build process that independently checks out the code and builds the source code, so that everyones changes are built and distributed together.

Yishai