Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Branching and merging

From: Fundamentals of Software Version Control

Video: Branching and merging

The last major piece of functionality we need to explore in TFS is branching and merging. Now, branching and merging are done quite a bit differently in TFS than they are, say in Git or Mercurial. It actually creates new folders inside your project folder. So we'll come over here to our Sample and say right-click, create a Branch, and we'll call it branch1. Now, you can see that there are actually two separate physical sets of folders inside this and this.

Branching and merging

The last major piece of functionality we need to explore in TFS is branching and merging. Now, branching and merging are done quite a bit differently in TFS than they are, say in Git or Mercurial. It actually creates new folders inside your project folder. So we'll come over here to our Sample and say right-click, create a Branch, and we'll call it branch1. Now, you can see that there are actually two separate physical sets of folders inside this and this.

You see it's created over here in the Folders section a new branch, and there's a little T symbol there that indicates that's a new branch. Like some of the other systems, the branch has been created, but it's not physically in the repository yet until we check it in. So we'll come over here to the Team Explorer, and we'll add a Comment, Create Branch1, and we'll check it in. So now we have our branch created, and you can see that the branch is actually stored in a completely separate folder, the branch is stored in our project folder under the folder TFSSample-branch1, whereas our original project is stored over here under FSVC1\ConsoleApplication1.

So in order to switch to the branch, we actually need to open up the appropriate Visual Studio solution for the files. So, for example, we'll come back to ConsoleApplication1, underneath branch1, and double-click on ConsoleApplication1.csproj. So now it looks like we're in the same place, except if we hover on top of the file name, you'll see that the full file name here says TFS1\ TFSSample-branch1\ ConsoleApplication1\f1.cs. So if we make a change here, instead of Node not found, we say Dwarf not found, and we save it, and we can check that in, Change node to Dwarf.

If we now come back to our Source Code Explorer and ask to View History, you see that we have a completely separate set of Changesets for the branch. Now, this is different again than the version Git and Mercurial in that there is a set of Changesets for each branch that are completely independent. So now if we want to switch back to our other branch, to the main branch, we can come here to ConsoleApplication1 and once again open up ConsoleApplication1.csproj, and you can see, not only we are back to Node, but if we hover here, you can see we're back in the FSVC1 directory.

So now let's do something in the branch so that we can actually have something to merge. We'll go back to our Source Code Control Explorer, go back to our ConsoleApplication1 in the branch, open up the project again. Now, we're not only going to change node to Dwarf, we're going to add another function, and then we're going to check this in, save it, check it in, and once again if we look at the History of our branch, you can see we have our Add func2.

Now let's go back to the Source Code Control Explorer, let's go back to this original main branch, open up that project. Then we are going to come back to the Source Code Control Explorer, and we're going to merge. So we right-click on the name of the folder, come to Branching and Merging and select Merge. Now it's going to ask us what we want to merge with, and it's really clear here that it allows you to decide which way you want to go. Now, in on our case, this merging is wrong direction. This says right here the way it's configured now, that would be merging our main branch into branch1.

We want to go the other direction. So we'll use Browse and select branch1 as the Source, and you can see it automatically updated the target branch, because TFS is smart enough to know you only have two branches. If that weren't the case, we can come here and Browse and select the main branch. Now we'll click Next, and it asks us which type of merging do we want to do? Do we want to do it to the Latest Version or to a particular Changeset or Label or Date? In this case, we'll use the Latest Version. It says all necessary information has been collected, and it's getting ready to merge.

We click Finish button, and the merge is done. Now it tells us that our file has been modified outside the Editor, because the Editor had the version that was in the main branch, and when we did the update, it actually updated the file in our Working Set directory on disk, but hasn't actually updated the Editor, so we're going to say Yes, we want it to reload. And now when we come back to f1.cs, you can see, not only do we have Dwarf, because that was the change we made in the branch, we also have our function 2, so we've successfully merged back from our branch back to the main.

And if you recall our conceptual overview, this is called a reverse integration, we actually took what was in the branch and brought it back into the main. Now, if you're going to continue keep working in the branch over a long period of time, you'll want to make sure that you do a forward integration by doing that merge in the opposite direction from the main branch back to your private branch on a fairly regular basis, for example, weekly, to make sure that your private branch doesn't get too far out of date with changes that other people are making to the main branch.

That's actually it for TFS. Since we've used TFS only with the GUI, there isn't any movie for using GUI and shell integration, because TFS integration is all done completely inside Visual Studio. I hope you've liked the overview of TFS. Obviously, Microsoft has tons of additional documentation videos on Channel 9, lots of information on being able to understand how to more effectively use Team Foundation Server.

Show transcript

This video is part of

Image for Fundamentals of Software Version Control
Fundamentals of Software Version Control

49 video lessons · 11555 viewers

Michael Lehman
Author

 
Expand all | Collapse all
  1. 2m 12s
    1. Welcome
      56s
    2. What you should know before taking this course
      23s
    3. Using the exercise files
      53s
  2. 25m 8s
    1. Overview of software version control
      2m 51s
    2. Understanding version control concepts
      5m 14s
    3. Demo one: Getting started
      11m 1s
    4. Demo two: Handling the "oops"
      6m 2s
  3. 11m 3s
    1. The history of version control
      3m 44s
    2. Terminology
      4m 27s
    3. Exploring centralized vs. distributed systems
      2m 52s
  4. 28m 42s
    1. Getting files in and out of a repository
      4m 38s
    2. Saving changes and tracking history
      2m 47s
    3. Reverting to a prior version
      1m 42s
    4. Creating tags and labels
      1m 5s
    5. Branching and merging
      4m 10s
    6. Exploring workflow integration and continuous builds
      2m 46s
    7. Using graphical user interface (GUI) tools
      2m 39s
    8. Integrating a version control system with an integrated development environment (IDE)
      2m 50s
    9. Examining shell integration
      3m 26s
    10. Looking at forward and reverse integration
      2m 39s
  5. 25m 59s
    1. Installation and setup
      3m 31s
    2. Creating a repository and a project
      5m 10s
    3. Working with check-in, checkout, and revert
      6m 12s
    4. Tagging
      1m 34s
    5. Branching and merging
      5m 32s
    6. Working with GUI clients and IDE integration
      4m 0s
  6. 16m 13s
    1. Installation and setup
      55s
    2. Working with check-in, checkout, and revert
      9m 34s
    3. Tagging
      1m 7s
    4. Branching and merging
      4m 37s
  7. 26m 41s
    1. Installation and setup
      3m 47s
    2. Creating a repository and a project
      6m 15s
    3. Working with check-in, checkout, and revert
      8m 31s
    4. Tracking history and tagging
      2m 15s
    5. Branching and merging
      5m 53s
  8. 19m 25s
    1. Installation and setup
      3m 1s
    2. Creating a repository and a project
      1m 6s
    3. Working with check-in, checkout, and revert
      6m 39s
    4. Tagging
      2m 13s
    5. Branching and merging
      3m 44s
    6. Working with GUI clients and IDE integration
      2m 42s
  9. 16m 54s
    1. Installation and setup
      1m 48s
    2. Creating a repository and a project
      59s
    3. Working with check-in, checkout, revert, and tracking history
      6m 9s
    4. Tagging
      1m 50s
    5. Branching and merging
      4m 29s
    6. Exploring GUI and shell integration
      1m 39s
  10. 3m 38s
    1. Selecting a software version control that is right for you
      2m 30s
    2. Next steps
      1m 8s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Fundamentals of Software Version Control.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.