GitHub Extension for Visual Studio

The GitHub Extension for Visual Studio editor enables you to identify the difference between the two files and automatically fix the merge conflicts by selecting a specific branch.

While the merge conflict tool found in Visual Studio isn’t specific to having the GitHub Extension installed, the extension allows you to log in quickly (even with two factor authentication), and utilize aspects of GitHub such as pull requests and quickly clone repositories.

instructions for this activity

To see the GitHub Extension for Visual Studio merge conflict tool in action, perform the following:

If you already completed all of the exercises in this course, you can re-import the course repository and give it a different name.

  1. Select File > Open > Open from Source Control from the main menu.
  2. Search for and clone your repository.
  3. From the branch selection tool in the bottom right corner, select New Branch.
  4. From the master drop-down, select origin/username-config. Ensure the Checkout branch and Track remote branch options are selected and click the Create Branch button.
  5. Select the Solutions Explorer tab.
  6. Open the _config.yml file.
  7. Edit the _config.yml file, making changes to lines 12-19 and save the file.
  8. Right-click the _config.yml file and select Commit.
  9. Right-click the _config.yml file in the Changes pane and select Stage.

    If you haven’t saved the changes you made to the _config.yml file you will be prompted to save your changes.

  10. With the ‘_config.yml’ file staged, enter a commit message and click Commit Staged.
  11. Checkout the master branch from the branch selection tool in the bottom right corner.
  12. Select the Manage Branches option from the branch selection tool in the bottom right corner.
  13. Right-click the master branch and select the Merge From… option.
  14. Select the username-config branch in the Merge from branch: drop-down.
  15. Ensure the master branch is selected in the Into current branch: drop-down.
  16. Click the Merge button.
  17. When the merge conflict occurs, click the Conflicts: 1 option just below the Merge In Progress text.
  18. Click on the _config.yml file and select the Diff option. This will display the difference between the two branches.
  19. Click the Take Source option to merge the changes from the username-config branch into the master branch.
  20. Click the Commit Merge button.
  21. Enter a commit message in the commit message field and click the Commit Staged button.
  22. Congratulations, you resolved a merge conflict locally with the GitHub Extension for Visual Studio!

octocat wearing a red polo

Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!