Version Control Walkthrough (TFVC) Part 2 – Use the local workspace in online mode

Goal

Continued from Version Control Walkthrough (TFVC) Part 1 – Create a new workspace, we explore the functionality of local workspaces when working in online mode.

Context

We will open the FabrikamFiber CallCenter solution and make changes to it from inside and outside of Visual Studio.

Open FabrikamFiber Call Center solution

  • Open Source Control Explorer to FabrikamFiber\Dev\FabrikamFiber.CallCenter
  • Double-click FabrikamFiber.CallCenter.sln 

Make changes using Visual Studio

    • Open Solution Explorer and expand the FabrikamFiber.Web project
    • Expand the Helpers folder and double-click Guard.cs to view the C# source code.
    • Open Team Explorer and click the Pending Changes link. Note the collapsible sections for the Included Changes and the Excluded Changes.
      image
    • Note that in Visual Studio  you have the ability to undock the Pending Changes window from Team Explorer, you can do this by clicking the arrow in the top right corner of the pending changes section. 
      image

What the window looks like after being undocked
image

  • Add a comment to (or otherwise modify) the source code for the Guard class and save the file. Note that TFS immediately lists the file in the Include Changes section.
    image
  • Drag the entry for Guard.cs from Included Changes and drop it onto Drag changes here to exclude from the check-in under Excluded Changes. Note that the file is now listed in the Excluded Changes section.
    image
  • In Pending Changes click Actions, Undo All
  • In Undo Pending Changes dialog click Undo Changes
  • In Confirm Undo Checkout message box, click Yes to All. Note that the change is undone and the file is removed from Excluded Changes.

Make changes outside of Visual Studio

  • Open Source Control Explorer and browse to the FabrikamFiber.Web folder
  • Click on the link next to the label Local Path to open the location to which FabrikamFiber.Web mapped in windows explorer, which should be c:\hol\Dev\FabrikamFiber.Web
    image
  • Double-click readme.txt to open the file in Notepad then make a change and save it
  • Use Windows Explorer to delete the file Web.config and to add a new file Notes.txt
  • Double-click the Helpers folder, right-click Guard.cs, choose Open with, Notepad, make and save a change.
  • Switch back to Visual Studio and click Yes when prompted to reload the modified version of Guard.cs. Note that the project files that were modified are already listed under Included Changes, even though the changes were made outside of Visual Studio. Note too that the Excluded Changes section now includes a link Detected: 1 add(s), 1 delete(s).
  • Click the Detected: 1 add(s), 1 delete(s) link. Note that Promote Candidate Changes lists the other files that were modified
  • Click Promote. All the changes we made will now be in the Include Changes section
  • In Included Changes right-click the entries for the deleted Web.config (and Web.Debug.config and Web.Release.config if they exists in the list)
  • Click Undo
  • In Undo Pending Changes dialog, click Undo Changes. The deleted Web.config file is restored and is removed from the list of Included Changes
  • In Pending Changes click Actions, Undo All
  • In Undo Pending Changes dialog click Undo Changes
  • In Confirm Undo Checkout, click Yes to All. All changes are undone and are removed from Included Changes
  • Complete the clean-up by using Windows Explorer to delete the Notes.txt file that you created.

 

Next up: Version Control Walkthrough (TFVC) Part 3 - Use the local workspace in offline mode


Please send candid feedback!

image

We need your candid feedback. Here are some ways to connect with us:

  • Add a comment below.
  • Contact us on our blog.

References


A special thank you to everyone who laid the foundation this and ither version control guidance: Anil Chandr Lingam, Bijan Javidi, Bill Heys, Bob Jacobs, Brian Minisi, Clementino de Mendonca, Daniel Manson, Jahangeer Mohammed, James Pickell, Jansson Lennart, Jelle Druyts, Jens Suessmeyer, Krithika Sambamoorthy, Lennart Jansson, Mathias Olausson, Matt Velloso, Matthew Mitrik, Michael Fourie, Micheal Learned, Neno Loje, Oliver Hilgers, Sin Min Lee, Stefan Mieth, Taavi Koosaar, Tony Whitter, Willy-Peter Schaub, and the ALM Community.