You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/version-control/git-make-commit.md
+39-5Lines changed: 39 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Make a Git commit in Visual Studio
3
3
titleSuffix: ""
4
4
description: Make a Git commit in Visual Studio by using Git providers such as GitHub or Azure DevOps, or locally with no provider at all.
5
-
ms.date: 8/7/2025
5
+
ms.date: 11/25/2025
6
6
ms.update-cycle: 180-days
7
7
ms.topic: how-to
8
8
author: ghogen
@@ -49,7 +49,22 @@ New in [**version 17.12**](/visualstudio/releases/2022/release-notes-v17.12): Wh
49
49
50
50
### Review local changes with Copilot Chat
51
51
52
-
New in **version 17.13**: With [GitHub Copilot](../ide/visual-studio-github-copilot-install-and-states.md) installed, you can have GitHub Copilot review your code changes before you commit them. To use this feature, make sure that **Tools** > **Options** > **Preview Features** > **Pull Request Comments** is enabled, and also enable **Tools** > **Options** > **GitHub** > **Copilot** > **Source Control Integration** > **Enable Git preview features**.
52
+
New in **version 17.13**: With [GitHub Copilot](../ide/visual-studio-github-copilot-install-and-states.md) installed, you can have GitHub Copilot review your code changes before you commit them.
53
+
54
+
:::moniker-end
55
+
56
+
:::moniker range="visualstudio"
57
+
58
+
To enable this feature, open the **Tools** > **Options** pane, expand the **All Settings** > **Preview Features** section, and select the **Pull Request Comments** checkbox. Expand the **All Settings** > **GitHub** > **Copilot** > **Source Control Integration** section and select the **Enable Git preview features** checkbox.
59
+
60
+
:::moniker-end
61
+
:::moniker range="<=vs-2022"
62
+
63
+
To enable this feature, open the **Tools** > **Options** dialog, expand the **Environment** > **Preview Features** section, and select the **Pull Request Comments** checkbox. Expand the **GitHub** > **Copilot** > **Source Control Integration** section and select the **Enable Git preview features** checkbox. Select **OK**.
64
+
65
+
:::moniker-end
66
+
67
+
:::moniker range=">=vs-2022"
53
68
54
69
In the **Git Changes** window, click on the **Review changes with Copilot** button, which looks like a comment icon with a sparkle.
55
70
@@ -62,6 +77,7 @@ The code review feedback shows up as comments, which show brief summary of the p
To remove all comments, use the **X** in the Git Changes window to close the Copilot code review link.
80
+
65
81
:::moniker-end
66
82
67
83
## Revert, reset, or amend a commit
@@ -71,22 +87,40 @@ When you double-click a **Commit**, Visual Studio opens its details in a separat
71
87
:::image type="content" source="media/vs-2022/git-branch-commit-details.png" alt-text="The Commit Details dialog in Visual Studio 2022.":::
72
88
73
89
:::moniker range=">=vs-2022"
90
+
74
91
## Generate commit messages with GitHub Copilot Chat
75
92
76
93
With Visual Studio version 17.9 and later and the GitHub Copilot extensions, you can use AI to generate detailed commit messages that describe your changes.
77
94
78
95
> [!NOTE]
79
-
>To enable AI-generated commit messages, you need GitHub Copilot and GitHub Copilot Chat. To get started, see [Get GitHub Copilot for Visual Studio 2022](../ide/visual-studio-github-copilot-install-and-states.md).
96
+
>To enable AI-generated commit messages, you need GitHub Copilot and GitHub Copilot Chat. To get started, see [Get GitHub Copilot for Visual Studio 2022](../ide/visual-studio-github-copilot-install-and-states.md).
When you're ready to make a commit, use the sparkly pen icon (tooltip: **Add AI generated commit message**) at the lower right of the commit message text box to request an AI-generated commit message. The AI-generated text is generated and added to anything you already had. Read it carefully to see if it's accurate. You have the option of accepting the insertion or discarding it. If you accept the insertion, you can then edit the text before submitting it. When you're ready, choose the **Commit Staged** button, or one of the other commit options available in the dropdown below the commit message editbox.
84
101
85
-
With Visual Studio 2022 version 17.12 and later, you can customize the commit message format globally by giving additional guidance in the prompt for GitHub Copilot. To add custom prompt instructions, open **Tools** > **Options** > **GitHub Copilot**, and under **Commit message custom instructions**, enter your additions to the prompt text. The changes affect every commit message. With this prompt guidance in place, teams can standardize commit message formats.
102
+
:::moniker-end
103
+
104
+
:::moniker range="visualstudio"
105
+
106
+
You can customize the commit message format globally by giving additional guidance in the prompt for GitHub Copilot. To add custom prompt instructions, open the **Tools** > **Options** pane, and expand the **All Settings** > **GitHub** > **Copilot** > **Source Control Integration** section. In the **Commit message custom instructions** box, enter your additions to the prompt text. The changes affect every commit message. With this prompt guidance in place, teams can standardize commit message formats.
107
+
108
+
:::image type="content" source="./media/visualstudio/git-customize-commit-message-with-ai.png" border="false" alt-text="Screenshot that shows how to to add a custom prompt for commit message with Tools Options.":::
109
+
110
+
:::moniker-end
111
+
:::moniker range="<=vs-2022"
112
+
113
+
With Visual Studio 2022 version 17.12 and later, you can customize the commit message format globally by giving additional guidance in the prompt for GitHub Copilot.
114
+
115
+
To add custom prompt instructions, open the **Tools** > **Options** dialog, and expand the **GitHub** > **Copilot** section. Under **Source Control Integration** group, enter your additions to the prompt text in the **Commit message custom instructions** box and select **OK**. The changes affect every commit message. With this prompt guidance in place, teams can standardize commit message formats.
86
116
87
117

88
118
89
-
GitHub Copilot understands terms like "subject" (the first line of the commit message), "body" (the section describing the changes in more detail), and "footer" (the final section). Some examples include "Use all lowercase," "Limit subject to 50 characters," "Limit body to 2 sentences," "Add a footer with three hash marks", or "Follow Conventional Commits standard", which references the widely used [Conventional Commits](https://www.conventionalcommits.org/) standard.
119
+
:::moniker-end
120
+
121
+
:::moniker range=">=vs-2022"
122
+
123
+
GitHub Copilot understands terms like "subject" (the first line of the commit message), "body" (the section describing the changes in more detail), and "footer" (the final section). Some examples include "Use all lowercase," "Limit subject to 50 characters," "Limit body to 2 sentences," "Add a footer with three hash marks," or "Follow Conventional Commits standard," which references the widely used [Conventional Commits](https://www.conventionalcommits.org/) standard.
90
124
91
125
> [!NOTE]
92
126
> Read about how GitHub Copilot protects the privacy of your data at [GitHub Copilot Business Privacy Statement](https://docs.github.com/site-policy/privacy-policies/github-copilot-business-privacy-statement).
Copy file name to clipboardExpand all lines: docs/version-control/git-with-visual-studio.md
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: About Git in Visual Studio
3
3
titleSuffix: ""
4
4
description: Explore Git options for source control in Visual Studio and track the code changes you make over time or revert to specific versions.
5
-
ms.date: 11/13/2025
5
+
ms.date: 11/25/2025
6
6
ms.topic: overview
7
7
author: ghogen
8
8
ms.author: ghogen
@@ -26,7 +26,7 @@ To get started using Git with Visual Studio:
26
26
27
27
- Otherwise, easily [create a new Git repository and add your code](git-create-repository.md). If you don't have a Git provider yet, we recommend you start with GitHub since the Git experience in Visual Studio is optimized for this provider. GitHub offers free and secured cloud code storage where you can store your code and access it from any device, anywhere.
28
28
29
-
Not only can you add both [GitHub and GitHub Enterprise accounts to your keychain](../ide/work-with-github-accounts.md), but you can also leverage them just as you do with Microsoft accounts. If you don’t have a GitHub account, follow these steps to [create a GitHub account to use with Visual Studio](git-create-github-account.md) now. Also, with Visual Studio 17.12 and later, you can add multiple GitHub accounts, and switch between them as needed. See [Add GitHub accounts to your Visual Studio keychain](../ide/work-with-github-accounts.md).
29
+
Not only can you add both [GitHub and GitHub Enterprise accounts to your keychain](../ide/work-with-github-accounts.md), but you can also apply them just as you do with Microsoft accounts. If you don’t have a GitHub account, follow these steps to [create a GitHub account to use with Visual Studio](git-create-github-account.md) now. Also, with Visual Studio 17.12 and later, you can add multiple GitHub accounts, and switch between them as needed. See [Add GitHub accounts to your Visual Studio keychain](../ide/work-with-github-accounts.md).
30
30
31
31
:::image type="content" source="media/vs-2022/git-source-control-create-repository.png" alt-text="Screenshot of the Create a Git Repository dialog box in Visual Studio." lightbox="media/vs-2022/git-source-control-create-repository.png":::
32
32
@@ -44,7 +44,7 @@ Once you create a new branch and switch to it, you can start working by changing
44
44
45
45
Git is a distributed version control system, meaning that all the changes made so far are local-only changes. To contribute these changes to a remote repository, you must [push those local commit(s) to a remote](git-push-remote.md).
46
46
47
-
If you are working in a team, or if you are using different machines, you might often need to fetch and pull new changes on the remote repository. To learn more about managing Git network operations in Visual Studio, refer to the [Fetch, pull, push, and sync](git-fetch-pull-sync.md) page.
47
+
If you're working in a team, or if you're using different machines, you might often need to fetch and pull new changes on the remote repository. To learn more about managing Git network operations in Visual Studio, refer to the [Fetch, pull, push, and sync](git-fetch-pull-sync.md) page.
48
48
49
49
:::image type="content" source="media/vs-2022/git-source-control-inner-loop.png" alt-text="Screenshot of Visual Studio IDE with the Git menu and the Git Changes tab in Solution Explorer showing." lightbox="media/vs-2022/git-source-control-inner-loop.png":::
50
50
@@ -85,21 +85,22 @@ Conflicts can occur during a merge if two developers modify the same lines in a
85
85
86
86
:::moniker-end
87
87
88
+
To personalize your Git settings at a repository level as well as at a global level, follow these steps:
89
+
88
90
:::moniker range="visualstudio"
89
91
90
-
To personalize your Git settings at a repository level as well as at a global level:
91
-
1. Go to either **Git** > **Settings** on the menu bar or **Tools** > **Options** > **Source Control** > **Git Global Config**.
92
+
1. On the menu bar, select **Git** > **Settings**, or open the **Tools** > **Options** pane and expand the **All Settings** > **Source Control** > **Git Settings** > **Git Global Config** section.
93
+
92
94
1. Choose the [options](git-settings.md) you want.
93
95
94
-
:::image type="content" source="media/visualstudio/git-options-settings.png" alt-text="Screenshot of the Options dialog box where you can choose personalization and customization settings in the Visual Studio IDE." lightbox="media/visualstudio/git-options-settings.png":::
96
+
:::image type="content" source="media/visualstudio/git-options-settings.png" alt-text="Screenshot of the Options pane where you can choose personalization and customization settings in the Visual Studio IDE." lightbox="media/visualstudio/git-options-settings.png":::
95
97
96
98
:::moniker-end
97
-
98
99
:::moniker range="vs-2022"
99
100
100
-
To personalize your Git settings at a repository level as well as at a global level:
101
-
1. Go to either **Git** > **Settings** on the menu bar or **Tools** > **Options** > **Source Control** > **Git Global Settings**.
102
-
2. Choose the [options](git-settings.md) you want.
101
+
1. On the menu bar, select **Git** > **Settings**, or open the **Tools** > **Options** dialog and expand the **Source Control** > **Git Global Settings** section.
102
+
103
+
1. Choose the [options](git-settings.md) you want.
103
104
104
105
:::image type="content" source="media/vs-2022/git-options-settings.png" alt-text="Screenshot of the Options dialog box where you can choose personalization and customization settings in Visual Studio IDE." lightbox="media/vs-2022/git-options-settings.png":::
105
106
@@ -139,21 +140,21 @@ There are three ways to start using Git with Visual Studio to be more productive
139
140
-[Open an existing Git repository](#open-an-existing-local-repository-in-visual-studio-2019). If your code is already on your machine, you can open it by using **File** > **Open** > **Project/Solution** (or **Folder**) and Visual Studio automatically detects if it has an initialized Git repository.
140
141
141
142
> [!NOTE]
142
-
> Starting with Visual Studio 2019 [version 16.8](/visualstudio/releases/2019/release-notes-v16.8), we include a fully integrated GitHub account experience. You can now add both GitHub and GitHub Enterprise accounts to your keychain. You can add and leverage them just as you do with Microsoft accounts, which means that you'll have an easier time accessing your GitHub resources across Visual Studio. For more information, see the [Work with GitHub accounts in Visual Studio](../ide/work-with-github-accounts.md) page.
143
+
> Starting with Visual Studio 2019 [version 16.8](/visualstudio/releases/2019/release-notes-v16.8), we include a fully integrated GitHub account experience. You can now add both GitHub and GitHub Enterprise accounts to your keychain. You can add and apply them just as you do with Microsoft accounts, which means that you'll have an easier time accessing your GitHub resources across Visual Studio. For more information, see the [Work with GitHub accounts in Visual Studio](../ide/work-with-github-accounts.md) page.
143
144
144
145
> [!TIP]
145
146
> If you don’t have a GitHub account, you can start by following the steps outlined in the [Create a GitHub account to use with Visual Studio](git-create-github-account.md) page.
146
147
147
148
## Create a new Git repository in Visual Studio 2019
148
149
149
-
If your code is not associated with Git, you can start by creating a new Git repository. To do so, select **Git** > **Create Git Repository** from the menu bar. Then, in the **Create a Git repository** dialog box, enter your information.
150
+
If your code isn't associated with Git, you can start by creating a new Git repository. To do so, select **Git** > **Create Git Repository** from the menu bar. Then, in the **Create a Git repository** dialog box, enter your information.
150
151
151
152
:::image type="content" source="media/git-create-repository.png" alt-text="The Create a Git Repository dialog box in Visual Studio.":::
152
153
153
-
The **Create a Git repository** dialog box makes it easy to push your new repository to GitHub. By default, your new repository is private, which means that you are the only one who can access it. If you uncheck the box, your repository will be public, which means that anyone on GitHub can view it.
154
+
The **Create a Git repository** dialog box makes it easy to push your new repository to GitHub. By default, your new repository is private, which means that you're the only one who can access it. If you uncheck the box, your repository is public, which means that anyone on GitHub can view it.
154
155
155
156
> [!TIP]
156
-
> Whether your repository is public or private, it's best to have a remote backup of your code stored securely on GitHub even if you are not working with a team. This also makes your code available to you no matter what computer you're using.
157
+
> Whether your repository is public or private, it's best to have a remote backup of your code stored securely on GitHub even if you aren't working with a team. This also makes your code available to you no matter what computer you're using.
157
158
158
159
You can choose to create a local-only Git repository by using the **Local only** option. Or, you can link your local project with an existing empty remote repository on Azure DevOps or any other Git provider by using the **Existing Remote** option.
159
160
@@ -201,7 +202,7 @@ As you do your work, Visual Studio keeps track of the file changes to your proje
201
202
202
203
:::image type="content" source="media/git-changes-window.png" alt-text="The Git Changes window in Visual Studio.":::
203
204
204
-
When you are ready to stage changes, click the **+** (plus) button on each file you want to stage, or right-click a file and then select **Stage**. You can also stage all your modified files with one click by using the stage all **+** (plus) button at the top of the **Changes** section.
205
+
When you're ready to stage changes, click the **+** (plus) button on each file you want to stage, or right-click a file and then select **Stage**. You can also stage all your modified files with one click by using the stage all **+** (plus) button at the top of the **Changes** section.
205
206
206
207
When you stage a change, Visual Studio creates a **Staged Changes** section. Only changes in the **Staged Changes** section are added to the next commit, which you can do by selecting **Commit Staged**. The equivalent command for this action is `git commit -m "Your commit message"`. Changes can also be unstaged by clicking the **–** (minus) button. The equivalent command for this action is `git reset <file_path>` to unstage a single file or `git reset <directory_path>` to unstage all the files in a directory.
207
208
@@ -212,7 +213,7 @@ Visual Studio also makes it easy to commit and sync with one click by using the
212
213
:::image type="content" source="media/git-file-version-compare.png" alt-text="The line-by-line comparison of file versions in Visual Studio ":::
213
214
214
215
> [!TIP]
215
-
> You can associate an Azure DevOps work item with a commit by using the "#" character if you are connected to the Azure DevOps repository. You can connect your Azure DevOps repository through **Team Explorer** > **Manage Connections**.
216
+
> You can associate an Azure DevOps work item with a commit by using the "#" character if you're connected to the Azure DevOps repository. You can connect your Azure DevOps repository through **Team Explorer** > **Manage Connections**.
216
217
217
218
### Select an existing branch in Visual Studio 2019
218
219
@@ -300,7 +301,7 @@ To personalize and customize your Git settings at a repository level as well as
300
301
301
302
## How to use the full Team Explorer experience in Visual Studio 2019
302
303
303
-
The new Git experience is the default version control system in Visual Studio 2019 from [version 16.8](/visualstudio/releases/2019/release-notes/) onwards. However, if you want to turn it off, you can. Go to **Tools** > **Options** > **Environment** > **Preview Features** and then toggle the **New Git user experience** checkbox, which will switch you back to Team Explorer for Git.
304
+
The new Git experience is the default version control system in Visual Studio 2019 from [version 16.8](/visualstudio/releases/2019/release-notes/) onwards. However, if you want to turn it off, you can. Go to **Tools** > **Options** > **Environment** > **Preview Features** and then toggle the **New Git user experience** checkbox, which switches you back to Team Explorer for Git.
304
305
305
306
:::image type="content" source="media/git-opt-new-user-experience.png" alt-text="The Preview Features section of the Options dialog box in Visual Studio ":::
0 commit comments