GitHub Workflow Integrations: Using GitHub for Visual Studio

Visual Studio is different from Visual Studio Code. Visual Studio is an IDE and is a full-featured application to support developers in writing code. Both VS Code and Atom are editors that have an extensive list of extensions that a developer can add to the editor to create the experience they need. Visual Studio has a version for Mac and a version for Windows. This section talks only about the version for Win­dows because it’s the original and more full-featured version and the one that has the GitHub integration.

After you install Visual Studio, choose Tools o Extensions and Updates. A pop-up window appears with all the extensions you currently have installed, plus the marketplace of additional extensions. If you click Online, the top choice is the GitHub Extension for Visual Studio extension, as shown in Figure 13-16.

Click the Download button and close Visual Studio. When Visual Studio closes, the VSIX Installer starts and ask whether it can modify Visual Studio. When you click yes, then modify, the extension begins to install. After it installs, click the Connect link in the Team Explorer tab and connect to your GitHub account, as shown in Figure 13-17. When you click the Connect link, a pop-up window asks you to sign in to GitHub. If you have two-factor authentication set up, you’re also asked for your 2fa code.

Once connected, you can clone a repo, create a new repo, or sign out from GitHub, all from the Connect page on the Team Explorer pane.

1. Viewing, creating, and reviewing pull requests in Visual Studio

When you have the project open in Visual Studio that is connected to a GitHub repo, you see additional project options on the home page of the Team Explorer pane, as shown in Figure 13-18.

Clicking Pull Requests opens the GitHub pane where all the pull requests on this repo are listed, as shown in Figure 13-19. At the top of the list, you can choose to see all the open pull requests, closed pull requests, or just all pull requests. You can also sort by author.

If you double-click one of the pull requests, the details open. From here, you can see the description, the target and base branch, the current state, the list of reviews, and the list of files changed. You can also click the View on GitHub link to open a browser window to this pull request on github.com. Click the Checkout <branch-name> button to check out the branch associated with this pull request. Click the Add your review link to add your own review with inline and overall comments. When you add a review, you can mark it as comment only, approve it, or request changes. If you double-click one of the changed files, the diff opens in the editor area. If you hover over one of the changed lines, you can add an inline comment, very similar to how it is done in VS Code (refer to Figure 13-11). You can see all of this in Figure 13-20.

2. Following the GitHub for Visual Studio extension

The GitHub for Visual Studio extension is open source. You can follow the devel­opment, report issues, or even contribute to it on GitHub.com. Go to https://github.com/github/visualstudio to find the latest features and documentation for how to use the GitHub for Visual Studio extension to improve your develop­ment workflow.

The GitHub team working on the extension often use a tracking issue to track what it’s working on. You can find the most recent tracking issue for this project by going to the Issues tab on the GitHub repo and filtering the issues by the Next Release label.

Source: Guthals Sarah, Haack Phil (2019), GitHub for Dummies, Wiley.

Leave a Reply

Your email address will not be published. Required fields are marked *