Bewerken

Delen via


Compare the Git experience to Team Explorer in Visual Studio 2019

We launched the first version of a Git experience in Visual Studio 2019 version 16.8. This experience helps reduce context switching with a simple Git Changes window that includes common Git tasks. It also includes a screen-wide Git Repository window for more advanced Git operations, such as branch management and repository browsing.

If you’ve been using Team Explorer, here is a step-by-step guide that explains how you can use the Git experience.

Note

The following section includes screenshots sized to fit in the columns of a table. Click each screenshot to view a larger version of it. (If you're using a touchscreen device, tap each screenshot to view a larger version of it.)

Get started

Team Explorer The Git experience
Clone a repo Screenshot of the Connect window for Team Explorer in Visual Studio 2019, with a 'clone a repo' procedure overlay.

1. Open the Connect page.
2. Expand Manage Connections.
3. Select Connect to Project.
Screenshot of the Git menu in Visual Studio 2019, with a 'clone a repo' procedure overlay.

1. Open the Git menu.
2. Select Clone Repository.

Switch between repos Screenshot of the Connect window for Team Explorer in Visual Studio 2019, with a 'switch between repos' procedure overlay.

1. Open the Connect page.
2. Select a repository from the Local Repositories list.
Screenshot of the Local Repositories menu item in Visual Studio 2019, with a 'clone a repo' procedure overlay.

1. Open the Git menu.
2. Select a repository from the Local Repositories list.
Open a solution Screenshot of the Home window for Team Explorer in Visual Studio 2019, with an 'open a solution' procedure overlay.

1. Open the Home page in Team Explorer.
2. Select a solution from the solution list.
Screenshot of Solution Explorer in Visual Studio 2019, with an 'open a solution' procedure overlay.

1. Open the Switch Views page in Solution Explorer.
2. Select a solution from the solution list.
Add a solution to source control and create a new repository Screenshot collage of Team Explorer options in Visual Studio 2019, with an Add to Source Control - Create Repo procedure overlay.

1. Select Git from the Add to Source Control status bar menu.
2. Select Publish.
Screenshot collage of Git options in Visual Studio 2019, with an 'add to source control - create repo' procedure overlay.

1. Select Git from the Add to Source Control status bar menu, or select Git > Create Git Repository from the top-level Visual Studio menu bar.
2. Select Create and Push.

Note: Use the existing remote option if you want to add your code to Azure DevOps. In this case, you must create an Azure DevOps repository first.

Tip

The Git experience should automatically connect to the correct Azure DevOps repo based on the repository or solution you opened. However, if you need to manually connect to the repo, you can still do that by using Team Explorer. From the Visual Studio menu bar, select View > Team Explorer > Manage Connections > Connect.

Git changes

Team Explorer The Git experience
Commit and stage Screenshot of the Changes window for Team Explorer in Visual Studio 2019, with a 'commit and stage' procedure overlay.

1. Enter a commit message.
2. Select Commit All.
3. To stage specific files, right-click them, and then select Stage.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'commit and stage' procedure overlay.

1. Enter a commit message.
2. Select Commit All.
3. To stage specific files, hover over them, and then click the “+” icon.
Amend a commit Screenshot of the Changes window for Team Explorer in Visual Studio 2019, with an 'amend a commit' procedure overlay.

1. Click the Actions drop-down.
2. Select Amend Previous Commit.
Screenshot of the Git Changes window in Visual Studio 2019, with an 'amend a commit' procedure overlay.

1. Click the Amend checkbox.
2. Click Commit All to commit your updates.
Stash a change Screenshot of the Changes window for Team Explorer in Visual Studio 2019, with a 'stash a change' procedure overlay.

1. Click the Stash drop-down.
2. Select the relevant Stash option.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'stash a change' procedure overlay.

1. Click the Commit All drop-down.
2. Select the relevant Stash option.

Synchronization

Team Explorer The Git experience
Fetch, pull, and push changes Screenshot of the Synchronization window for Team Explorer in Visual Studio 2019, with a 'fetch, pull, and push' procedure overlay.

1. Navigate to the Synchronization page.
2. Click the network operation of your choice.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'fetch, pull, and push' procedure overlay.

1. Locate the fetch, pull, and push buttons in the Git Changes window.
2. Click the network operation of your choice.
View Incoming and Outgoing commits Screenshot of the Synchronization window for Team Explorer in Visual Studio 2019, with a 'view incoming and outgoing commits' procedure overlay.

1. Navigate to the Synchronization page.
2. View your incoming and outgoing lists.
Screenshot of the Git Changes window and the Git Repository window in Visual Studio 2019, with a 'view incoming and outgoing commits' procedure overlay.

1. Click the outgoing / incoming link in the Git Changes window.
2. View your incoming and outgoing commits by using the icons in the graph table at the top of the Git Repository window.

Branches

Team Explorer The Git experience
Create a branch Screenshot of the Branches window for Team Explorer in Visual Studio 2019, with a 'create a new branch' procedure overlay.

1. Navigate to the Branches window.
2. Click New Branch.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'create a new branch' procedure overlay.

1. On the Git Changes window, click the branch drop-down list.
2. Click New Branch.
Get the latest changes from a remote branch Screenshot of the Branches window for Team Explorer in Visual Studio 2019, with a 'get recent changes from remote branch' procedure overlay.

1. Navigate to the Branches page.
2. Right-click the remote branch and select Merge From or Rebase Onto.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'get recent changes from remote branch' procedure overlay.

1. Click the branch drop-down list.
2. Under the Remotes tab, click the remote branch and select Merge into Current Branch or Rebase Current Branch onto.
Manage branches Screenshot of the Branches window for Team Explorer in Visual Studio 2019, with a 'manage branches' procedure overlay.

1. Navigate to the Branches window.
2. Right-click the branches that you would like to manage.
3. View History of branches to manage commits.
Screenshot collage of how three UI options to use to manage branches in Visual Studio 2019.

1. Navigate to the Git repository window by using one of the following entry points:

a. From the top-level Visual Studio menu, select Git > Manage Branches.
b. Select Git changes > incoming/outgoing.
c. From the status bar menu at the bottom-right, select Manage Branches.

2. From the top-level Git > Manage Branches menu, do either of the following actions:

A. Right-click the branches.
B. Multi-select the commits that you want to manage.

Conflict resolution

Team Explorer The Git experience
Access list of files with conflicts Screenshot collage of the Changes window and the Resolve Conflicts window for Team Explorer in Visual Studio 2019, with a procedure overlay.

1. Navigate to the Resolve Conflicts window by clicking the Conflicts link.
2. Use the Conflicts list to resolve your merge conflicts.
Screenshot of the Git Changes window in Visual Studio 2019, with a 'resolve conflicts' procedure overlay.

1. Verify that Merge in progress with conflicts appears.
2. The list of files with merge conflicts appears in the Unmerged Changes section of the Git Changes window.
Resolve the conflicts.