Announcing the Release of the Git Experience in Visual Studio

Avatar

Pratik

We’re excited to announce that our new Git tooling is now the default source control experience in Visual Studio 2019, beginning with version 16.8. We’ve been working on this experience over the last year, iterating based on your feedback to build out key features, enhance performance, and fine tune quality. Above all, we’ve focused on improving discoverability for your common workflows and simplifying navigation to reduce context-switching. Regardless of whether you are part of a large team or working on a personal project, whether you are an experienced developer or just starting out, we strongly believe the new Git experience in Visual Studio 2019 will have something for you. Here’s seven reasons why we think you should try it out.

Git Productivity Demonstration in Visual Studio 2019 v16.8

Git Productivity in Visual Studio 2019

Redesigned Git repository creation

To get started with Git, Visual Studio lets you add your local code to Git and GitHub with a single click. The Create a Git repository dialog contains the new integrated GitHub sign-in flow, similar to what we offer for Microsoft accounts. Here, you can set the repository to be publicly visible or switch it to private. That makes it securely accessible to only you and any designated collaborators. In addition to GitHub, you can also push your code to an existing remote repository. This can be one you’ve already created on Azure DevOps or any other provider. And finally, you can choose to create a local-only Git repository if you are not ready to push to a remote host.

Image createrepodialog

Create Repository dialog

Accessible top level Git menu

You can now access your favorite Git features using the top level Git menu. It’s at easy reach through the Alt+G keyboard shortcut. This menu also has the Local Repositories submenu. By expanding it, you can easily switch between local Git repositories you have previously opened in Visual Studio.

Image 16 8 P3 reposlist

Git menu with Local Repositories list

View files in Solution Explorer

After you’ve opened or cloned a Git repository, Visual Studio helps you get straight to your code. Solution Explorer loads the root of the repository and scans the directory for any View files. Instead of having to search for your .sln file to open it, Visual Studio detects and loads the solution automatically. If your repository has more than one .sln file, then Solution Explorer shows you the list of available views to choose from. Subsequently, you can toggle between the currently open Solution (view) and the list of Views by using the Switch Views button in the Solution Explorer Toolbar.

Image 16 8 P2 listofviews

Switch Views in Solution Explorer

Streamlined inner loop Git Changes window

The new Git Changes window is designed to provide quick access to commonly used Git operations that you need while you are coding. You can create new branches, stash, stage, amend, and commit changes, all from the same place without switching pages or losing context. Moving to the top of the window, you’ll see handy fetch, pull, and push buttons. They allow you to sync commits and tags with your remotes (that’s right, multiple remotes!). The Git Changes window also has an indicator displaying the number of outgoing and incoming commits. This indicator functions as a link to take users to the Git Repository window. From there, you can view a summary of your outgoing and incoming commits before you sync.

Image gitchangeswindow

Staged Changes and Stashes in the Git Changes Window

Full screen Git Repository window

If you like browsing and managing your repository, you no longer need to leave Visual Studio. The new Git experience comes with a rich Git Repository window that makes it easy to visualize the entire history of your repository. You can right click on a branch to perform operations like merge, rebase, reset, and cherry pick. Moreover, the Repository window is accessible through the Git menu, the View menu, and the status bar.

Image GitRepoWindow

Branch History in the Git Repository Window

Enhanced merge conflict resolution

If you run into a merge conflict, Visual Studio now guides you through the process of resolving it. The Git Changes tool window clearly lists unmerged changes. Also, it displays a status message specifying that conflict resolution is in progress. Further, a gold info bar in the conflicting file prompts you to open the Merge Editor. Once you’re there, the three-way Merge Editor takes you through each conflict in the file. In other words, it allows you to compare lines and even individual word-level differences. Moreover, you can accept all current or incoming changes at the file level with a single click.

Image git merge editor

Merge Conflict Resolution with the Merge Editor

Customizable experience

We want you to be able to personalize your Git experience. To change any of your preferences at the repository level or the global level, go to Git – Settings in the menu bar. This will take you to the consolidated Tools – Options pane for Source Control.

Image Git Settings

Git Settings in Tools – Options dialog

However, if these features aren’t working out for you, it’s possible to revert back to the full Team Explorer experience. Go to Tools – Options – Environment – Preview Features and toggle the New Git user experience checkbox. Please let us know why!

Image git preview feature

New Git user experience Preview Feature flag

This is just the beginning

To summarize, from the new Git menu, you can clone, create, or open repositories. You can use the integrated Git tool windows to commit and push changes to your code, manage branches, sync your remote repositories, and resolve merge conflicts. Find the full list of capabilities in the Release Notes. Learn how to use the features in our documentation. Most importantly, join the conversation on Developer Community to weigh in on what we’re building next. And please provide feedback as we continue to enhance the Git experience in Visual Studio!

196 comments

Comments are closed. Login to edit/delete your existing comments

    • Taysser Gherfal
      Taysser GherfalMicrosoft employee

      Thanks for the feedback Matthew. In this case, we had to revamp our git experience for the following reasons:
      1- Discoverability: when we started evaluating our previews git experience, we asked users what they think about the git tooling in VS2019. A very popular answer was “what git tooling? I don’t see any?” Not everyone knew that our git tooling is in Team Explorer. Some users thought that it is only used for TFVC. Others just didn’t make the connection.
      2- Context switching: a large population of users who knew Team Explorer complained about the fact that they needed to continually navigate between different pages to go through their git work flow.
      3- Learning curve: we also found that it takes users a long time to learn and get used to Team Explorer.

      We didn’t want to continue adding more features to Team Explorer without addressing these issues. Otherwise, it will just continue to get more complicated. Our approach with the new experience is based on customer feedback. When it comes to git we found out that there are two types of operations: light inner loop operations that users wanted to do on the side while they are coding and advanced git operations that users wanted to focus on.

  • Avatar
    Gavin

    Just for people reading this blog post who aren’t familiar with VS and Git, there’s nothing new here – VS has always guided you through the merge process, you’ve always been able to see the history of your repo, you’ve always had blame and staging, etc. etc. Mostly some very valuable integrations with Azure DevOps have been removed. I think it’s worth pointing this out because I’ve seen comments elsewhere that seem to indicate that some people think that these capabilities weren’t in VS before because of the wording in this blog.

    • Taysser Gherfal
      Taysser GherfalMicrosoft employee

      Thanks for your feedback Gavin, I have to disagree with you here sir. Let me explain the difference:

      VS has always guided you through the merge process
      – That is true, but only if you know where to look. For someone who don’t know that they should open Team Explorer to resolve their merge, they thought that we didn’t have a merge resolution experience
      – With the new experience, conflicts are way more discoverable even if you are not viewing the git changes window, the editor will provides an entry point

      You’ve always been able to see the history of your repo, you’ve always had blame and staging, etc.
      – That is true, but there was no easy way to browse and manage your repository in one place. With the new experience, you get a complete picture where you can view branches, the graph, and incoming/outgoing commits at the same time. And this is just the beginning!
      – We still haven’t had a chance to enhance our blame experience that is correct, but it is in our roadmap. Stay tuned!
      – When it comes to staging, we have added hover icons where you can stage files with a single click. Now we are working on line staging. Stay tuned!

      • Avatar
        Mikael Gustafsson

        My bad, I was on 16.8 Preview 2 and did not get the settings menu item. After updating (in my case to 16.9.0 Preview 1) The -force-with-lease is implemented exactly as i would have wanted it to work. Great job guys!! I love the feature even more 🙂

    • Taysser Gherfal
      Taysser GherfalMicrosoft employee

      Thanks for the feedback Stéphane, clicking on the outgoing / incoming link in the Git Changes window will take you to the Git repository window where you can manage your repository and view incoming / outgoing commits. Please let us know if you still can’t find this. Also feel to look at our documentation

  • Pacurariu Cristian
    Pacurariu Cristian

    Have I missed something on the docs ? I haven’t seen anything about the option of Stashing and I don’t see the option in the new Git Experience / Git changes tab in Visual Studio.
    I can see the changes, but I cannot stash them from VS.

    • Avatar
      Pratik NadagoudaMicrosoft employee

      The option to Stash is definitely present. It’s in the dropdown button for Commit All. You can see the button here in the docs. And you can see the Stashes list in the Git Changes window. But you’re absolutely right, I noticed we’ve omitted mentioning the command in the documentation. I’ll make sure that’s fixed asap. Thanks for the feedback!