How to review changes in a pull request without switching branches in Visual Studio – 065

I’m disrupting your regularly scheduled tip series to talk about the awesome work the Editor Tools team has been doing at GitHub. I’m too impatient to wait for the series to catch up!

We have a GitHub Extension for Visual Studio that’s available in Visual Studio Gallery / Marketplace which is also an open source project at https://github.com/github/visualstudio. You can go to Tools – Extensions and Updates and under Online search for GitHub to install.

Once installed, you can open the GitHub tool window from View – Other Windows – GitHub

In the interest of time, I’m going to assume you are 1. connected to GitHub (either by signing in via Team Explorer or the GitHub tool window) and 2. in Team Explorer, you’re connected to a GitHub repo, as shown below

Team Explorer - Connect showing connected to SimpleConsoleApp repo

How to review changes in a pull request without switching branches

1. Go to Team Explorer –  Home – Pull Requests

Team Explorer - Home - Pull Requests button being clicked

Clicking Pull Requests will take you to the GitHub tool window, showing all of your open pull requests for your currently connected repo.

Note by default the GitHub tool window shows Open pull requests. You can filter to see closed and all pull requests.

GitHub tool window showing an open pull request 

2. Click on the title of the pull request (e.g. added a message) to view the details.

GitHub - Pull Request Details View

Ignore my funky font sizes. I’m making it to 40 without computer glasses. That one summer 10 years ago was an exception.

Lots of stuff going on here. We see

  • User drofaras wants to submit her (yes, my alias spelled backwards) branch patch-1 (the default name GitHub supplies to branches created via the website) into master.
  • A”checkout” link button, but the goal of this blog post is to review changes without switching branches. (stay tuned for tomorrow)
  • The details about the pull request and the option to view it on GitHub.
  • Lastly, there’s Changes (1) because only one file has been changed.

3. Double-Click on Program.cs to view the file diff

VS showing the diff between the two files

And that’s how you can do a diff between two files without switching branches within Visual Studio using the GitHub extension.

To show we’re still on the same branch as before (e.g. master), go to Team Explorer – Home – Branches to verify.

Team Explorer - Branches showing master as current branch

Got Feedback?

I strongly recommend using one of the existing channels for feedback. Of course, I’ll help anyone who leaves comments. It’s just that if you use one of the existing channels, your feedback and questions go to the entire team; whereas this blog is my nights and weekends project, so it’ll take me a while to respond, but I will respond. Just don’t ask me how small my queue of tips has become! O_O

One thought on “How to review changes in a pull request without switching branches in Visual Studio – 065

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s