From the course: Working with LinkedIn Learning Exercise Files on GitHub

Use Diff tools to compare two branches - GitHub Tutorial

From the course: Working with LinkedIn Learning Exercise Files on GitHub

Use Diff tools to compare two branches

- [Instructor] In this video, let's take a look at how to check out the differences between two branches. So, currently, I'm in branch 04-11 and I would like to compare what changed between this and the previous branch. That's branch 04-02. So, the way you do that is we go to the Git menu and you choose view branch history. And this tells me all of the changes available. And I can see here on this date that I had branch 402, and I created a new branch based on that, and this is the new branch. And I want to compare the two of them. So, I shift click to select the two of them, right click, and choose compare commits. And that brings up this side bar, which shows the comments when we checked in the code. The important part for us in this demo is down here at the bottom. There were two files that were changed between branches. Something changed in the sln file and something changed in this Robot.cs file. To find out the changes, to bring up the div tool, double click on the file like this. Now I see, I have the older version on the left and the newer version on the right. And it looks like there's only one line in the sln file that changed. Something changed here. Now let's bring back the compare commits window and double click on Robot.cs to see the differences. So, here I can see that I changed the name of this variable in the for loop. I changed the if statement. And I wrote a lot more code in the new branch. So, this shows you how you can use the built-in div tool as part of Visual Studio and load the two sides of the div tool with information from the branches.

Contents