Skip to content

Commit 18a81cc

Browse files
Merge pull request #11146 from MicrosoftDocs/main638998598507020881sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents d5cb378 + 635310d commit 18a81cc

12 files changed

+354
-105
lines changed

docs/version-control/git-make-commit.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Make a Git commit in Visual Studio
33
titleSuffix: ""
44
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
66
ms.update-cycle: 180-days
77
ms.topic: how-to
88
author: ghogen
@@ -49,7 +49,22 @@ New in [**version 17.12**](/visualstudio/releases/2022/release-notes-v17.12): Wh
4949

5050
### Review local changes with Copilot Chat
5151

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"
5368

5469
In the **Git Changes** window, click on the **Review changes with Copilot** button, which looks like a comment icon with a sparkle.
5570

@@ -62,6 +77,7 @@ The code review feedback shows up as comments, which show brief summary of the p
6277
![Screenshot showing GitHub code review comment.](./media/vs-2022/git-code-review-comment.png)
6378

6479
To remove all comments, use the **X** in the Git Changes window to close the Copilot code review link.
80+
6581
:::moniker-end
6682

6783
## Revert, reset, or amend a commit
@@ -71,22 +87,40 @@ When you double-click a **Commit**, Visual Studio opens its details in a separat
7187
:::image type="content" source="media/vs-2022/git-branch-commit-details.png" alt-text="The Commit Details dialog in Visual Studio 2022.":::
7288

7389
:::moniker range=">=vs-2022"
90+
7491
## Generate commit messages with GitHub Copilot Chat
7592

7693
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.
7794

7895
> [!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).
8097
8198
![Screenshot showing AI-generated commit message.](./media/vs-2022/git-commit-message-ai.png)
8299

83100
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.
84101

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.
86116

87117
![Screenshot showing Tools Options GitHub Copilot settings page with custom prompt for commit messages.](./media/vs-2022/git-customize-commit-message-with-ai.png)
88118

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.
90124

91125
> [!NOTE]
92126
> 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).

docs/version-control/git-with-visual-studio.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: About Git in Visual Studio
33
titleSuffix: ""
44
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
66
ms.topic: overview
77
author: ghogen
88
ms.author: ghogen
@@ -26,7 +26,7 @@ To get started using Git with Visual Studio:
2626

2727
- 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.
2828

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).
3030

3131
:::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":::
3232

@@ -44,7 +44,7 @@ Once you create a new branch and switch to it, you can start working by changing
4444

4545
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).
4646

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.
4848

4949
:::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":::
5050

@@ -85,21 +85,22 @@ Conflicts can occur during a merge if two developers modify the same lines in a
8585

8686
:::moniker-end
8787

88+
To personalize your Git settings at a repository level as well as at a global level, follow these steps:
89+
8890
:::moniker range="visualstudio"
8991

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+
9294
1. Choose the [options](git-settings.md) you want.
9395

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":::
9597

9698
:::moniker-end
97-
9899
:::moniker range="vs-2022"
99100

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.
103104

104105
:::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":::
105106

@@ -139,21 +140,21 @@ There are three ways to start using Git with Visual Studio to be more productive
139140
- [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.
140141

141142
> [!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.
143144
144145
> [!TIP]
145146
> 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.
146147
147148
## Create a new Git repository in Visual Studio 2019
148149

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.
150151

151152
:::image type="content" source="media/git-create-repository.png" alt-text="The Create a Git Repository dialog box in Visual Studio.":::
152153

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.
154155

155156
> [!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.
157158
158159
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.
159160

@@ -201,7 +202,7 @@ As you do your work, Visual Studio keeps track of the file changes to your proje
201202

202203
:::image type="content" source="media/git-changes-window.png" alt-text="The Git Changes window in Visual Studio.":::
203204

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.
205206

206207
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.
207208

@@ -212,7 +213,7 @@ Visual Studio also makes it easy to commit and sync with one click by using the
212213
:::image type="content" source="media/git-file-version-compare.png" alt-text="The line-by-line comparison of file versions in Visual Studio ":::
213214

214215
> [!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**.
216217
217218
### Select an existing branch in Visual Studio 2019
218219

@@ -300,7 +301,7 @@ To personalize and customize your Git settings at a repository level as well as
300301

301302
## How to use the full Team Explorer experience in Visual Studio 2019
302303

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.
304305

305306
:::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 ":::
306307

211 KB
Loading
103 KB
Loading

0 commit comments

Comments
 (0)