Exciting new updates to the Git experience in Visual Studio

Pratik N

Update Nov. 17, 2020: Integrated Git experience released

We’ve seen a lot of enthusiasm in the past few months with the improvements we’ve been making to the Git integration for Visual Studio 2019. You can learn more about how to use the entire feature set in our new documentation. We’ve also received a healthy amount of good feedback that’s helped us focus our efforts. We first announced the new changes in a blog post in March. Since then, the team has been hard at work analyzing the feedback, polishing the user interface, and building more features. We’re excited to share those updates with you today.

If you haven’t tried the new Git user experience in Visual Studio yet, download the latest Preview and you’ll get the newest updates to the experience by default. If you’re using the public Release of Visual Studio (version 16.6+), then hit Ctrl+Q to search and type in ‘New Git user experience’ to turn it on from the Preview Features pane of Tools – Options.

Image Tools Options Preview Features

New Git user experience Preview Feature flag

You can turn the experience off using the same checkbox.

Merge Conflict Resolution improvements

As we talked to customers about the pain points they face when working with source control, we consistently heard about the frustration with merge conflicts. When you get a merge conflict, it interrupts your coding flow and forces you to switch context. We also realized we needed better messaging to indicate you encountered a conflict during a Git pull operation. To address these concerns, the Git Changes tool window now clearly lists unmerged changes and displays a status message specifying that conflict resolution is in progress.

Image image of Git Changes window with unmerged changes

Merge in progress with conflicts (unmerged changes)

In addition, in our user studies, as we walked through different workflows, we noticed that not all developers always have the Git Changes window open. If you don’t, you’ll only see the file with conflict indicators and may try to manually resolve the conflicts in-line. We all know how painful that can be, especially for large files with many conflicts. So, we added a gold info bar at the document level to notify you when the file contains conflicts, prompting you to open the Merge Editor.

Image image of merge editor gold info bar

Gold info bar with link to open merge editor

The three-way Merge Editor has undergone quite a revamp based on ongoing customer feedback. We’ve changed the legacy TFVC terminology of Source and Target to Incoming and Current with a strong emphasis on the branch name. This used to be a constant point of confusion. Incoming and Current also each have a new checkbox to take all changes from either version with a single click.

Image Merge Editor Names

Incoming / Current and branch names in the Merge Editor headings

The Merge Editor now makes it easier to parse conflicts by better aligning matching lines, displaying word level differences, and making differing whitespace visible. We’ve also reduced the clutter around the zoom margin, health margin, and toolbar. Further, you can turn off non-conflicting differences to just focus on the conflicts. And if you don’t need the horsepower of the Merge Editor, such as in Add/Add conflicts, you can resolve those now at the file level with a two-way merge.

Image gif of merge editor

Merge editor experience

Brand NEW Git Repository window

After we launched the first version of the Git Changes tool window, we wanted to make sure we incorporated community feedback and suggestions as we iterated on the experience. Our research informed us there are specific Git operations most of you perform while coding that made sense in the Git Changes window adjacent to your editor. But other times, you need a full-screen experience to focus on a dedicated Git activity. So, in Version 16.7 Preview 3, we built the Git Repository window, the future home for all your Git related activities. It’s now available in Visual Studio Preview, with some initial functionality.

First, we built an interactive branch tree where you can manage all the branches in the repository in a single view. From here you can use the context menu to Fetch, Pull, and Push branches without having to check them out. You can also create a new branch directly from any local or remote branch. We’ve also added the commands to Reset, Cherry-Pick, and Unset Upstream Branch, which weren’t available in the Git Changes branch picker.

In addition to using the power-packed context menu, you can also double click a branch in the list to show you its history in the right pane. At the top of the graph, you can see incoming commits after performing Fetch. Soon, you’ll be able to see outgoing commits as well. Double clicking on a commit will open its metadata in the Commit Details pane. You can access this window through the Manage Branches command in the Git menu as well as the Unpushed Commits button in the Status Bar

This is just the first iteration of the Git Repository window and we will continue to build more features into it. But in the meantime, we’re eager for you all to try it out and let us know what you think.

Image Git Repo window

Manage branches and view history from the Git Repository window

Additional updates

Create a repository

You can now create a new repository on GitHub, Azure Repos, or any remote URL at any time, even from an empty folder. Visual Studio will help you initialize the new repository locally as well as push it to your remote GitHub account. Use the existing remote option to push your code to a hosted Git repository you’ve already created.

Image Create a new repo

Create a new repository and push it to GitHub

Git Settings

It’s super important to be able to personalize and customize your Git settings at a repository level as well as at a global level. We’ve migrated all your settings to Tools – Options – Source Control.

Image Image of settings pane

Git settings

Streamlined Push

Along the lines of better error management, we’ve enhanced the Push experience so that if you Push changes before pulling upstream changes, you get options to Force Push or Pull and Push. To Force Push, you first need to enable ‘push –force’ in your Git settings.

Image Streamlined Push dialog

Dialog to help with Pushing commits

Git Changes window

We’ve been improving the new Git Changes window that we first introduced in Version 16.6. We enhanced the branch picker by adding special icons to more easily differentiate between remote branches, local branches tracking a remote, and local branches not tracking a remote.

Image Git Changes Ref Picker

Branch Picker in Git Changes window

Work Items

And finally, when the new Git experience is enabled, work items and builds can still be accessed from Team Explorer.

Image Work items in Team Explorer

Team Explorer Home page with Work Items and Builds

Wrapping up

As you can hopefully tell, we’ve been spending a bit of time to improve this experience. We see that remote work and collaboration are becoming more important than ever. And that’s why we continue to invest in these areas. Let us know in the comments what you think and what you’d additionally like to see here. We track all our customer asks in Suggestion Tickets on the Developer Community portal. Even though we sometimes don’t get to all of them immediately, we really appreciate the suggestions you make. And we do enjoy engaging in design conversations on the portal. Thank you for the ongoing feedback; you keep us honest and make us better.

Stay safe. Stay healthy.


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

  • Max Mustermueller

    The Github experience since the Preview version of VS is SO much better now. No more going forth and back. The only thing I’m still missing is to delete a branch (after merged) not just locally but also on Github. Currently I still have to visit Gitub to delete it there as well.

  • Reese Perry

    Great! But now can we get the Pull Request working for team explorer or new git? Also the work items associate with changes how does that work? Doesn’t seem to be working but I also didn’t have any changes to actually commit. So only other thing is being able to associate work item tickets with commits like i used to be able to in team explorer.

  • Matthew Puglisi

    Actually, to Force Push you must feel the force around you. 🤭

      • Philippe Miossec

        As ‘–force-with-lease’ is a better practice, perhaps you could add the support of this option?

        • Pratik NadagoudaMicrosoft employee

          Yep, the option we’re enabling there is ‘–force-with-lease’, since as you stated, it is safer than just ‘–force’. I’ll look into making that clearer.

  • Fawad Raza

    This caused a side effect. Solution Explorer window has lost its red tick icon (file changed so different from git’s version) for everything except for C# files.

    So if you change any *.chtml or *.ts file, the red tick does not appear anymore. Only appears against C# changed files. Please check.

    Kind Regards.

  • Patrice Tremblay

    Thanks for all the new features!

    I have the “New Git user experience” preview feature enabled. I can follow along you blog post without any problem.
    Except, I don’t get access to the Builds and Work Items from Team Explorer. Is that a known issue?

  • Dean Jackson

    In the “Incoming and Current” example you showed, was this for a “pull”, meaning the latest Master files are coming into your current/local copy? Or was it for a push, meaning your local changes are coming into the remove master copy?

    Picking words for this is hard, but I think trying to use 1-word labels makes it much harder. In your example, “Incoming” isn’t clear to me, but I guess it would be if I knew the context of your example. I think you shouldn’t be scared to use several words as a label, to make sure it’s clear.

    • Pratik NadagoudaMicrosoft employee

      It was for a ‘pull’, so that changes are coming into my local branch. If you try to push before you pull your remote changes, then with the new streamlined push, we prompt you to pull first. Because we want to avoid pushing first in that scenario. Then if it results in any conflicts, you resolve them locally before you push. That’s why the naming implies remote changes coming into local.

      If the conflict came from a push, then it probably would make more sense to say changes going out to remote. i.e. outgoing. And your remote is current But yes, that’s good feedback, and we’ll try to make it more clear. There’s an open suggestion ticket where we’ve been discussing – https://developercommunity.visualstudio.com/idea/502400/resolve-conflict-source-and-target-is-confusing.html

      • Dean Jackson

        So for push, what would the labels say…would it be “Incoming” for the local copy and “Current” for the master/main?

  • Kyle Ballard

    The preview experience completely removes a feature I rely on to stay within Visual Studio when switching projects. In the current version going to the Home view shows all solution files found within a repository. This saves my team and I many steps when switching projects and the loss in a future version would be devastating.

  • Oli Baylis

    Is it still possible to link an Azure DevOps work item to a git commit? I don’t see the option and have made sure I’m conneted to a DevOps project in Team Explorer

      • Greg Veres

        This alone is enough to make me NOT use the new git experience. Every single checkin must be associated with a work item from Azure Dev Ops, so if that is difficult to get to, then you guys have just completely busted the git experience inside VS. Not having this undoes every ounce of good stuff this change brings.

        I just can’t over state enough how bad it is to not have the ability to associate a work item with the git commit on the same screen. I will go vote up the issue you linked to.

  • zephania Eliah

    I have been facing an issue with the new git experience after initializing a local git when i need to push my code online its keeps forcing me to use Github or Github enterprise and there is no option to choose azure repos and all our previous projects are hosted with azure repos….

  • Valdis Iljuconoks

    Plugin becomes better and better. But I was just wondering – when Git submodules will be fully supported? I mean – enlisting changes made to the files located in submodule? Now VS shoes just change in submodule but refuses to show concrete files. VS Code on the other hand – has no problems with this scenario. Opening VS Code just for this…