From the course: Windows Presentation Foundation 5: Interaction and Controls

Use Checkout to open exercise files from Git branches

From the course: Windows Presentation Foundation 5: Interaction and Controls

Start my 1-month free trial

Use Checkout to open exercise files from Git branches

- [Narrator] Here on the GitHub website, you'll see that the project is organized into branches. Click on this branch drop down, and this is the list of branches that are available for this project. Each branch corresponds to one chapter in this course. They are named according to the chapters. So, there's one called Control, another one called Decorators. When I include a finished version of the exercises, like you see here, it'll be called Decorators_Done. This same list of branches is available from within Visual Studio. In Visual Studio, you need to open the project. You can open the project any way that you like. You can go to the File, Open, Project/Solution, and navigate out to the Repo folder. Here I am in my Repos folder. So, I can go to this folder and then open the Solution file. That loads the solution and the project and it will default to the master branch. So, you'll see the master branch loaded here. Now, here's where we can open up the different branches. So, currently, I'm in the master branch. If you look on the bottom bar in Visual Studio, you'll see that I've opened this repo, WPF_Controls, and I'm currently in the master branch. Now, let me pop this open and choose manage branches. This shows my local repos and the branches. And in this section, I can see the remote repo, the one on GitHub, and all the branches. So, when you want to open a branch, like this Button branch, just come in here, double click, that checks out the files, and two things happen. With Solution Explorer updates, you now have all the new files loaded in here, and in your branches section, you'll see that the Button branch is now in the local repo. Let's try another one. Let's go look at Shapes. So, I'll double click on this. You see that I now have Button, master, and Shapes in the local. Now, what's nice about this is you can follow along, look at the, in this case, you can see here's all of the pages I have to do with different shape demos. When you want to open another branch when you move to another chapter, go to this bar. If you've already checked out a copy and it's in your local repo when you click on this drop down, you'll see it at the top. So, you can always go and manage branches. If you've already checked it out, it'll show up in this top list. To switch back and forth, you just choose a new item. Currently, you can see I've got Shapes checked out. A couple ways I can see that. It's listed down here, it's also got a check mark next to it, and it's in gray. Now, I just move up here, and I click on a button, and keep your eye on this Pages folder. It's full of a different set of pages now. What you get is a quick way of switching from one branch to another without having to leave Visual Studio.

Contents