Compare the Git experience to Team Explorer in Visual Studio 2019
Artikkeli
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
1. Open the Connect page. 2. Expand Manage Connections. 3. Select Connect to Project.
1. Open the Git menu. 2. Select Clone Repository.
Switch between repos
1. Open the Connect page. 2. Select a repository from the Local Repositories list.
1. Open the Git menu. 2. Select a repository from the Local Repositories list.
Open a solution
1. Open the Home page in Team Explorer. 2. Select a solution from the solution list.
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
1. Select Git from the Add to Source Control status bar menu. 2. Select Publish.
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
1. Enter a commit message. 2. Select Commit All. 3. To stage specific files, right-click them, and then select Stage.
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
1. Click the Actions drop-down. 2. Select Amend Previous Commit.
1. Click the Amend checkbox. 2. Click Commit All to commit your updates.
Stash a change
1. Click the Stash drop-down. 2. Select the relevant Stash option.
1. Click the Commit All drop-down. 2. Select the relevant Stash option.
Synchronization
Team Explorer
The Git experience
Fetch, pull, and push changes
1. Navigate to the Synchronization page. 2. Click the network operation of your choice.
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
1. Navigate to the Synchronization page. 2. View your incoming and outgoing lists.
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
1. Navigate to the Branches window. 2. Click New Branch.
1. On the Git Changes window, click the branch drop-down list. 2. Click New Branch.
Get the latest changes from a remote branch
1. Navigate to the Branches page. 2. Right-click the remote branch and select Merge From or Rebase Onto.
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
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.
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
1. Navigate to the Resolve Conflicts window by clicking the Conflicts link. 2. Use the Conflicts list to resolve your merge conflicts.
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.