Exciting new updates to the Git experience in Visual Studio

Avatar

Pratik

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.

103 comments

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

  • Riani Witania
    Riani Witania

    I really curious on the software that you use for capturing motion of your tutorial. in 100% honesty and 30% of will effort.

  • Avatar
    Paul Cohen

    We seem to have lost the ability to get any Git menu’s in Solution Explorer. I always used “Compare With Unmodified” under Solution Explorer now I have switch to Git Changes Windows Find the File (which was highlighted in Solution Explorer), right click… That’s a lot of extra steps.

  • Avatar
    Paul Cohen

    Is there a plan a plan to provide documentation or tutorial on how to use some of the new functionality? Thinks link Branch Tree and Cherry-Pick would be helpful. Is it possible to just Cherry-Pick a file from one branch to another (from Master to Feature for example).

  • Avatar
    R. A. Raboud, Jr.

    When will we be able to check in changes to submodules like we can in VS Code?

  • Avatar
    Julien Jacobs

    I started to use the new Git window and overall I like it. Few things that I am missing from Team Explorer

    1. Be able to view the Git tags (only Local/Remotes now)
    2. Be able to drag/drop files into in from Changes to Staged Changes
    3. Linking work items (but can live with just using #123 in the comment)

    Keep up the good work! I was never a big fan of the Team Explorer (which I only use for Git)…everything else in the browser

  • Gunnar Dalsnes
    Gunnar Dalsnes

    I very much miss recursive “traffic lights” (status icons) in solution explorer, just like VisualSvn has. Having status icons only on lowest level (the changed files) is extremely annoying once you have ever used VisualSvn.

  • Avatar
    Jimbo Gilmour

    I have been using Git in Visual Studio 2019 it’s such an improvement over VS 2017 Git extension. The project I am working with others is over a quarter million lines. The speed of the new VS 2019 version is great and integration is really smooth.

  • Avatar
    Yann Duran

    Surprisingly I like what you’ve done with the new Git Repository window so far.

    1. I miss the equivalent of the Team Explorer dropdown and toolbar. These made navigating between windows etc so much easier than what you seem to have to do now.

    2. I’m puzzled why you need to double-click on a branch to see the history for that branch. A single click would make a lot more sense. I would expect that a double-click would check the branch out, while a single click would show the history.

    3. Are you planning to add back a list of “local” repositories? And the ability to “add” them from a folder/folders on disk? This list was a very handy way to quickly open repositories that may not have been pushed to a remote repository. I know you can do it via things like the Start Window, but it’s quite an obtuse way of doing it compared to the Team Explorer local repositories list.

    Finally, if you want people to actually use the new Git windows in 16.7, there should be no lost functionality from what there was available in Team Explorer. I keep reading comments from developers that this this missing feature, or that missing feature, makes the new experience unusable for them, and I have to say that I strongly agree with those comments. Many of us just won’t be able to use the new experience/windows if there’s missing functionality. Workarounds where you have to go searching through various parts of Visual Studio are not going to solve most developers’ problems. After all the new Git experience is supposed to make using Git easier not harder, right?

    • Avatar
      Chuck Ryan

      Unfortunately lost, or missing, functionality is not a bug… it’s a feature of modern Microsoft development teams as they use Agile development methodologies in almost all of their products. This results in a nightmare scenario for customers as just about every product has partially implemented functionality as they drop existing features and slowly push out pieces of the supposed replacement.

    • Avatar
      Pratik NadagoudaMicrosoft employee

      Thanks for the feedback! I understand what you’re saying in terms of lost functionality. Our primary goal before making this experience the default is to ensure a parity with Team Explorer so that developers are not blocked in doing what they could before. Until then and even beyond, Team Explorer will still be available as we continue to get feedback and iterate.

      Single click to see branch history is coming soon! We got mixed feedback about double-clicking to check out branch. What if you double click by accident, checking out can be an expensive operation. But we have a suggestion ticket to track that request. Happy to hear your thoughts there – https://developercommunity.visualstudio.com/idea/1124138/git-repository-tab-double-click-on-a-branch-doesnt.html

      First version of a local repositories list is also coming soon – https://developercommunity.visualstudio.com/content/idea/987300/can-no-longer-see-all-local-repositories-by-clicki.html

    • Avatar
      Irina Pykhova

      agree. I see that if I open some project form existing local repo, VS shows this repository as if it was added. But if I open VS next time with empty environment, I don’t see any previously connected repos and only have 2 options: create new repository or clone existing one.
      Please consider to keep track of already connected repositories, so that people can see it on some prominent place

  • Avatar
    Abel Onditi

    Hey!

    Thank you for the feature! Its working wonders!

    I’ve used TFS (or Azure DevOps) with Visual Studio earlier and I’ve grown quite fond of the Source Control Explorer it has.

    Do you plan on implementing a Source Control Explorer similar to the one used with TFS? Could it be implemented?

    – Abel

    • Avatar
      Pratik NadagoudaMicrosoft employee

      You’re welcome! We actually haven’t looked into bringing in Source Control Explorer. What would be the main use cases that you would need it for in Git?

  • Avatar
    LOST

    The new interface is sleek. However, I could not find how to work with git tags.