views:

198

answers:

6

I and another programmer am working on the same program in Visual C#. I let him work on it, and then he uploads it and then I work on it, and then I upload it so that he can work on it. We take turns altering the source code.

However, this is kind of slow. It would be better if we were able to both work on the source code at the same time without taking turns, and then there was someway we could combine our changes easily. Is there a way to do that?

+25  A: 

Source control... Take a look at Subversion with TortoiseSVN front-end.

http://en.wikipedia.org/wiki/Source%5Fcontrol

Mike C.
SVN merge is a hidden gem. It worked very well for source code. (For example in java).
RocketSurgeon
Also, AnkhSVN is a great SVN integration into MSVS.
Crowe T. Robot
git, FTW: http://git-scm.com/ - but while we might nitpick on _which_ source control to use, you _need_ to use one.
Thanatos
Complement SVN merge with Beyond Compare. It's awesome for editing files side by side. You can pull stuff from one file and move it to the other etc.
nickyt
Or try Araxis Merge - I've been recommending it to my teams for years.
devstuff
+3  A: 

As Mike C. said, Source Control allow you to do that. Source Control creates a central place where code is stored, and allows teams to work simultaneously on the same code in a controlled way. When two programmers change the same file, the second one to check-in (upload their changes to the source control repository) is warned that another programmer has changed the same file and allows him/her to merge both changes if there are conflicts between them.

Other advantages are that it keeps a history of all changes made by every programmer so that you can trace who made what changes very easily.

Andrés G.
+3  A: 

This is why revision control systems came into existence. Now you NEED one. Take a look at the available softwares and pickone: http://en.wikipedia.org/wiki/List_of_revision_control_software

claws
+1  A: 

There's a lot of good free source control programs. I personally use Bazaar, very easy to work with and works with Windows well. Mercurial is also good, and so is Git by all accounts, though I haven't used that one myself. These three are all so-called distributed source control systems, which means you don't have to set up a central server. So for two guys it should be all you need.

However, if you want to opt for the central repository type of systems (check out/check in...,), both Subversion and Perforce are great. Perforce is a commercial system but for only 2 users the license is free. Although even using this type of workflow, you can adapt any of the distributed systems mentioned above to work this way.

Scott
+1  A: 

As others have said, "source control" (also known as "SCM") is what you want; in fact, what you wrote:

both work on the source code at the same time without taking turns, and then there was someway we could combine our changes easily

...is pretty much the definition of source control. (There's one additional major feature of SCM, which is history tracking, as Andres mentioned.)

Subversion is definitely the product you should be trying out. It's well documented, modern (ie: none of the "older" issues of CVS) and relatively simple compared to more powerful distributed systems like Git.

One important note: "combining our changes easily" is something that takes some dedicated learning and practice. "Merging" is the practice of taking code from two different sources and unifying them in a way that doesn't break things. It can be tricky and is quite confusing until you gain a deeper understanding of how it works. I'd recommend setting aside a day with your partner dev and practice doing dress-rehersals of combining your changes before you try doing it on real code. Again: Subversion is a great tool here because the documentation is very good and clearly written.

Craig Walker
+1 for merging advice.
devstuff
+1  A: 

As stated above, you really need to look into a source control system. Subversion may be the easiest for you, and you can elect to get another company to host it for you depending on your requirements. Use Ankhsvn or VisualSVN inside Visual Studio or TortoiseSVN as suggested.

If this project is opensource you can host it on Google Code or Github otherwise take a look at Assembla if you are unable to setup a boxen to host your repository. With Assembla you also get a copy of Trac which will give you a project management system as well (though I've used Trac for the past 3 years now, I've since moved onto Redmine). But there are other tools like Jira + Confluence etc once you have a source repository setup.

Please stay away from Visual Source Safe. Team Foundation Server is another you have to really think hard and determine whether you'll need the whole-shebag before going in for it.

If you go with TortoiseSVN, install WinMerge which will automatically be registered as the Diff tool, gives you a bit more oomph when doing some complex merging :-)

Thushan Fernando