Developer .NET UPDATE--Source Control Basics--May 5, 2006

This Issue Sponsored By
This email newsletter comes to you free and is supported by the following advertisers, who offer products and services that might interest you. Please take a moment to visit these advertisers' Web sites and show your support for Scripting Central.





1. Developer .NET Perspectives

  • Source Control Basics: Shelving, Branching, and Merging
  • 2. Events and Resources

  • The Essential Guide to Infrastructure Consolidation
  • Configuring and Managing a Virtual Lab for the Enterprise
  • Expect the Unexpected: Disaster Recovery
  • Maximize the Potential of Your Windows Environment
  • 3. Featured White Paper

  • Do You Need 100% Uptime For Your Mission-Critical Email?
  • 4. Announcements

  • SQL Server Magazine Master CD--SAVE 50%!
  • May Exclusive--Save $100 off the Exchange & Outlook Newsletter

  • Sponsor: Thawte

    The Starter PKI Program
    Do you need to secure multiple domains or host names? In this free white paper you'll learn how the Starter PKI Program will benefit your company with timesaving convenience. Plus - you'll get the chance to actually test the program!

    1. Developer .NET Perspectives

    by Bill Sheldon, [email protected]

    Source Control Basics: Shelving, Branching, and Merging
    As you probably know, Microsoft recently released Team Foundation Server. TFS lets developers manage the check-in and check-out of source files from within Visual Studio 2005. In addition to its role as a developer collaboration portal, TFS is the integrated source control server for Team System. In this capacity, TFS provides three features for managing source code:

  • Shelving, which is a new and much needed feature
  • Branching, which is helpful in specific situations
  • Merging, which should almost never be used
  • Let's take a look at these source control options and see where they fit in your software development process.

    Compared with Visual SourceSafe (VSS), shelving is a new feature that lets you easily follow a best practice: checking in your code changes on the server at the end of each day. Backing up your changes ensures that you don't lose your work because of a hardware failure or another type of failure. However, this practice poses a problem in that a developer often works on a set of code changes that aren't complete by the end of the day. The code involved won't build much less run--and when it's checked in, problems in the code might affect other team members who attempt to retrieve that same source code. As a result, while most organizations talk about checking in changes every day, those organizations using VSS rarely implement it.

    Shelving alleviates the problems posed by having a daily check-in. With TFS, you save a copy of your current changes to the source control repository at the end of the day. However, as part of this process, you indicate that the source code isn't ready for others to retrieve. The code is put on the shelf, so to speak. Only you will be able to access the shelved version. That way, your daily changes to the source code are backed up, but other team members won't be able to access the unfinished code.

    Shelving is a obviously a great way for one developer to back up his or her changes in the source repository, but what happens when more than one developer needs to access or work on the same source code? This is where the concepts of branching and merging come into play. The idea behind these concepts is that at some point you might need to have more than one copy of a source file.

    One reason why you might need more than one source file is if you have different versions of an application. For example, when you begin to work on version 2.0 of an application, you might want to keep a copy of the version 1.0 source files. That way, if someone finds a bug in the version 1.0 code, another developer can check out the version 1.0 source files and repair the bug. Because the version 1.0 source file isn't being worked on for new development, there's no risk that some incompatible version 2.0 code will be caught up in this bug fix. Then, as you work on version 2.0, you can determine the best solution for that version, given the other changes occurring in the application. In many cases, the version 1.0 bug won't be reproducible in version 2.0 due to other changes, so the fix won't be needed.

    Microsoft appears to follow this practice internally. If you've participated in a beta or release candidate (RC) program in which there are interim releases, you know that Microsoft branches a code base in preparation for a release. For example, the branched code for a beta 1 version might have several last minute patches to work around unfinished added features, even as the newly branched source files are modified in preparation for beta 2.

    In this scenario, branching is a best practice because it doesn't involve merging change sets. Merging is a way of attempting to combine changes made to the same source file by two different developers. Some organizations use merging, which is why it's supported. However, automatically merging changes from different developers is definitely a risky process. Here's why. Suppose developer A worked exclusively on method A and developer B worked exclusively on method B. In this case, the automated merge process is simple in that Developer A and Developer B worked on separate lines of the source file. However, this simple type of merge is the exception and not the rule.

    What happens when developer A and developer B make changes to the same method for different bug fixes that overlap logic within that application? There's no reliable automated process for merging changes on the same line. Merging changes will always require some level of human intervention and additional testing because when changes are merged, the resulting code might fail to build or develop new problems. Thus, although TFS's merging tool can be helpful in rolling a change from version 1.0 to version 2.0 of an application, using it in an active development cycle on a single version of an application is risky.

    For more information about shelving, branching, and merging, check out the following Web pages:

  • Shelving:
  • Branching and merging:

  • Sponsor: Hewlett-Packard

    Use scripted deployments to ensure that all your Exchange servers are configured and deployed with exactly the same options, and maintain a record of your installation configurations. Learn how today!

    2. Events and Resources

    (brought to you by SQL Server Magazine)

    The Essential Guide to Infrastructure Consolidation
    Learn the essentials about how consolidation and selected technology updates build an infrastructure that can handle change effectively.

    Configuring and Managing a Virtual Lab for the Enterprise
    Use virtual server technology to consolidate your production environment using only a fraction of the server hardware in the data center. Live Event: Thursday, May 18

    Expect the Unexpected: Disaster Recovery
    Learn to differentiate alternative solutions to disaster recovery for your Windows-based applications to determine what works for you and ensure seamless recovery of your key systems--whether a disaster strikes just one server or the whole site. Live event: Thursday, May 11

    Maximize the Potential of Your Windows Environment
    Increase administration efficiency, build flexible yet inexpensive file-server environments, and maximize potential through consolidation of your SQL Server environment. Make the most of your resources today!

    3. Featured White Paper

    Do You Need 100% Uptime For Your Mission-Critical Email?
    Learn how to address challenges such as making email truly available 24x7x365, securing against viruses, comprehensively backing up email data, and more.

    2006 Watch

    Ensure instant access to files at all remote servers and eliminate 95% of your network traffic.

    Confused by WAFS, Wide Area Mirroring, DFS, WAN acceleration, or Replication technologies? Do you have remote sites with common data or file needs? Get a free software trial, and register for the free seminar.

    4. Announcements

    (brought to you by SQL Server Magazine)

    SQL Server Magazine Master CD--SAVE 50%!
    Subscribe today and get portable, high-speed access to the entire SQL Server article database on CD: a searchable library that includes every SQL Server Magazine issue ever published. The newest issue also includes BONUS SQL Server 2005 Tips. Order now and save:

    May Exclusive--Save $100 off the Exchange & Outlook Newsletter
    For a limited time, order the Exchange & Outlook Administrator newsletter and SAVE up to $100! You'll get 12 helpful issues loaded with solutions you won't find anywhere else and FREE access to the entire Exchange & Outlook online article database. Subscribe now:

    Hot Spot

    When disaster strikes your servers, you need answers, whether they are dedicated to Windows, SQL, or Exchange. Make sure that if an emergency occurs, you're prepared. Get the full eBook and get started on your recovery plan today!

    Contact Us

  • About Developer .NET Perspectives -- [email protected]
  • About technical questions --
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • About sponsoring an UPDATE -- contact Richard Resnick, [email protected], or Lisa Kling, [email protected]
  • Developer .NET UPDATE is brought to you by SQL Server Magazine, the only magazine devoted to helping developers and DBAs master new and emerging SQL Server technologies and issues. Subscribe today.

    You can manage your SQL Server Magazine email newsletter subscriptions by going to

    You can view the SQL Server Magazine Privacy Policy at

    SQL Server Magazine is a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department

    Copyright 2006, Penton Media, Inc. All Rights Reserved.

    Hide comments


    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.