Using Git in Visual Studio has never been easier than in Visual Studio 2019

Visual Studio 2019 has many fantastic new features. Some of these features like the new start window make the use of Git in Visual Studio 2019 way easier than in the previous versions. Do you want to learn how to use Git in Visual Studio 2019?

Check out my new Pluralsight course

In my new Pluralsight course Using Git for Source Control in Visual Studio 2019, you will learn how to use Git in Visual Studio 2019 while working on a .NET application in the context of a small team.

My course is part of a Visual Studio 2019 course path at Pluralsight. Check out that course path to learn how to use Visual Studio 2019 successfully and efficiently in your projects. Also take a look at this Blog post from David Berry (Technical Curriculum Manager for .NET at Pluralsight) where you find also a bit more information about the upcoming Visual Studio 2019 courses.

In my course you’ll learn how Julia and I use Git to build a .NET Core application for the Wired Brain Coffee company. We will store our code in a Git Repository in Azure DevOps. The scenario looks like this:

The major topics that we will cover include:

  • Creating and cloning Git repositories
  • Committing and synchronizing changes
  • Working with branches and tags
  • Handling pull requests
  • Viewing the history of your code

Before you start, you should know the Git basics, but as the course uses a scenario to build the so-called Wired Brain Coffee Shop Info Tool, you should be able to follow along, even without any prior Git knowledge.

The Shop Info Tool that we build is a .NET Core Console app that allows the Wired Brain Coffee company to see how many kilograms of coffee beans and how many paper cups a specific coffee shop has in stock.

While building this tool, you’ll learn how to use Git in Visual Studio 2019.

What’s new for Git in Visual Studio 2019

When you start Visual Studio 2019, you’ll see the new start window.

From this new start window you can

  • Open a recent solution
  • Clone a Git repository from GitHub, Azure DevOps, or any other Git service
  • Open a project or solution
  • Open a folder
  • Create a new project
  • Continue without code

This means directly after starting up Visual Studio 2019 you can clone a Git repository. That’s really nice. In previous versions of Visual Studio, you had to open up Visual Studio, you had to navigate to Team Explorer, and there you had to navigate to the Connect page to clone a Git repo. While this path still works in Visual Studio 2019, Visual Studio 2019 makes it much simpler to clone a Git repository directly after you started Visual Studio, because now you can use the new start window to clone a Git repo.

Beside the new start window Visual Studio 2019 contains other great features to work with Git. For example, with the “Pull Requests for Visual Studio” extension, you can create, review, comment, and approve pull requests directly in Visual Studio 2019.

The following screenshot shows a pull request comment from Julia and me directly in the code editor. You can also see the pull request details in Team Explorer. Julia just approved that pull request directly in Visual Studio:

Beside these new features – using the new start window and handling pull requests in Visual Studio 2019 – you’ll learn in my course everything you need to work successfully with Git and Visual Studio 2019. You’ll even learn the differences between a merge and a rebase, and of course we do both in Visual Studio to update a feature branch with the latest changes from master. :)

Happy coding,
Thomas

Share this post

Comments (2)

  • Mladen Mihajlovic Reply

    Does the pull request feature work with self hosted tfs or only github?

    April 3, 2019 at 8:38 am
    • Thomas Claudius Huber Reply

      Hi Mladen,

      great question. So far, the “Pull Requests for Visual Studio” extension supports Azure Repos (= Git Repositories hosted in Azure DevOps). If you’re using GitHub, you might want to install the “GitHub extension for Visual Studio” that you find here: visualstudio.github.com.

      For Self hosted TFS, which is called these days Azure DevOps Server, the “Pull Requests for Visual Studio” extension has no support right now. You find this information here under “known issues” at the bottom: https://marketplace.visualstudio.com/items?itemName=VSIDEVersionControlMSFT.pr4vs.

      As it is a known issue, this might change in the future, so that the extension also supports Azure DevOps Server. But so far, nothing is known if and when Azure DevOps Server will be supported.

      I hope this helps.

      Thanks,
      Thomas

      April 3, 2019 at 9:27 am

Leave a Reply to Mladen Mihajlovic Cancel reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.