You were just about there:

I opened up Git > Manage Branches and see the commit i did and see a couple of options.

You'll want to learn more about the different git reset options and how they work, but the two reset options that Visual Studio offers are --mixed and --hard. To use the reset option, in the branch history graph, select the commit that you wish to reset your branch pointer to, and this will remove all of the commits above it (and if a merge commit is being removed it will also remove all commits brought in by that merge).

For your use case where you have one commit that you wish to remove, and re-commit some of it, select the parent commit of that commit (the one below your commit in the graph), right click on it, and select "Reset->Keep Changes (--mixed)". This will put you back into the state you were in before you created the commit, with nothing staged yet.

Side Notes:

  • If you don't want to keep any of your changes, you should choose --hard.
  • Note that VS doesn't offer the option to do a --soft reset in the GUI, but the only difference with --soft is that all your changes would be staged already, which you can manually do in the GUI after reset with --mixed.
  • The GUI command is identical to running the following command from the command line, e.g. a mixed reset: git reset --mixed <selected-commit-id>
Answer from TTT on Stack Overflow
Top answer
1 of 2
3

You were just about there:

I opened up Git > Manage Branches and see the commit i did and see a couple of options.

You'll want to learn more about the different git reset options and how they work, but the two reset options that Visual Studio offers are --mixed and --hard. To use the reset option, in the branch history graph, select the commit that you wish to reset your branch pointer to, and this will remove all of the commits above it (and if a merge commit is being removed it will also remove all commits brought in by that merge).

For your use case where you have one commit that you wish to remove, and re-commit some of it, select the parent commit of that commit (the one below your commit in the graph), right click on it, and select "Reset->Keep Changes (--mixed)". This will put you back into the state you were in before you created the commit, with nothing staged yet.

Side Notes:

  • If you don't want to keep any of your changes, you should choose --hard.
  • Note that VS doesn't offer the option to do a --soft reset in the GUI, but the only difference with --soft is that all your changes would be staged already, which you can manually do in the GUI after reset with --mixed.
  • The GUI command is identical to running the following command from the command line, e.g. a mixed reset: git reset --mixed <selected-commit-id>
2 of 2
0

You can effect an undo from within VS, but it's not an actual undo, it's a compensating commit that reverts you back to the prior state of the offending commit.

From the Search dropdown in the main menu select Feature Search. Type in View History or View Branch History and select that. A history of your commits will be listed. Right click the commit you want to undo and choose Revert.

I'd show a screenshot but I'd have to redact everything.

🌐
DEV Community
dev.to › thebernardlim › git-how-to-edit-or-remove-a-pushed-commit-using-visual-studio-2876
Git - How to edit or remove a "pushed" commit using Visual Studio - DEV Community
January 13, 2023 - Removing your previous commit from your local repo using Reset · On the menu bar in Visual Studio, click on Git -> View Branch History. Right click the commit that you would like to keep · Choose Reset -> Keep Changes (--mixed).
🌐
Reddit
reddit.com › r/git › (visual studio) how to undo all changes made to local repo after last git push ?
r/git on Reddit: (Visual Studio) How to undo all changes made to local repo after last git push ?
January 16, 2022 -

I am working on a project on Visual Studio 2019. The last git push I did was 2 weeks back. After that I made 12 changes to the local repo on my computer. However I realised I made a mistake and want to go back to the same version I got pushed to the master repo 2 weeks back.

How do I undo all the changes made to the project since the last git push ?

I am using the git extension "Visual Studio git extension" in Visual Studio 2019.

🌐
Developer Community
developercommunity.visualstudio.com › idea › 728035 › undo-last-commit.html
Undo last commit - Developer Community
Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › azure › devops › repos › git › undo
Undo changes in your Git repo - Azure Repos | Microsoft Learn
Unstaged files show up in the Changes section. If the file is in the Changes section, right-click it and choose Undo Changes to discard all changes to the file since the last commit.
Find elsewhere
🌐
Developer Community
developercommunity.visualstudio.com › t › reset-feature-keep-changes-and-delete-changes-not › 1649037
RESET feature - Keep Changes and Delete Changes not ...
Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
Nobledesktop
blog.nobledesktop.com › learn › git › view a list of commits & undo changes
View a List of Commits & Undo Changes: Git Tutorial
April 19, 2026 - This will keep your history cleaner. At the top right of Source Control panel click the More Actions button and from the menu choose Commit > Undo Last Commit. Your latest commit will now be undone.
🌐
LinkedIn
linkedin.com › learning › visual-studio-source-control-with-git-and-github › when-to-use-revert-or-reset
When to use revert or reset - Visual Studio Video Tutorial | LinkedIn Learning, formerly Lynda.com
March 1, 2020 - To get to these actions in Visual Studio, go to History, and then right click on one of the commits. There's two choices, Revert, and Reset with two options, Reset, Keep Changes and Reset, Delete Changes.
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › version-control › git-manage-repository
Manage Git repos in Visual Studio | Microsoft Learn
To learn more about reverting changes, see the Git webpage for the revert command. Use the reset command to bring a branch in your local repository back to the contents of a previous commit.
🌐
Bobby Hadz
bobbyhadz.com › blog › vscode-undo-last-git-commit
How to Undo the last Git Commit in Visual Studio Code | bobbyhadz
April 6, 2024 - You can also use git commands to undo the last commit in VS Code. ... Ctrl + Shift + P on Windows and Linux. Command + Shift + P on macOS. Note: you can also press F1 to open the Command Palette.
🌐
Reddit
reddit.com › r/vscode › how to undo "undo last commit" in source control action in vscode?
How to undo "Undo Last Commit" in source control action in vscode? : r/vscode
August 6, 2019 - TIL https://www.atlassian.com/git/tutorials/undoing-changes · Reply · reply · More replies More replies More replies More replies · Wtach · • · tldr: In console/shell: git reflog · Copy the hash of the undone commit · git reset --hard yourHash · Reply · reply · Top 2% Rank by size ...
🌐
Developer Community
developercommunity.visualstudio.com › t › there-should-be-a-way-to-undo-a-local-commit › 1577207
There should be a way to undo a local commit
November 9, 2021 - Skip to main content · Visual Studio · Guidelines Problems Suggestions Code of Conduct · Downloads · Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions · Subscriber Access · Microsoft Security Azure Dynamics 365 Microsoft 365 Microsoft ...
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › faq
Source Control FAQ
November 3, 2021 - This topic answers frequently asked questions about using Git source control and GitHub in Visual Studio Code. Revert your last commit with the Git: Undo Last Commit command. This will reset your branch to the state right before you did the ...
🌐
O'Reilly
oreilly.com › library › view › mastering-visual-studio › 9781787281905 › 102dbae6-7d96-4b82-99ab-8d0d6fd92b29.xhtml
Undoing your local changes - Mastering Visual Studio 2017 [Book]
July 27, 2017 - Undoing your local changes When you want to discard any modified files/folders, right click on them under Solution Explorer. From the context menu, select Source Control | Undo... - Selection from Mastering Visual Studio 2017 [Book]
Author   Kunal Chowdhury
Published   2017
Pages   466
🌐
O'Reilly
oreilly.com › library › view › mastering-visual-studio › 9781787281905 › 3e457f08-86e0-4d20-930b-f15e63ebc596.xhtml
Reverting changes from remote branch - Mastering Visual Studio 2017 [Book]
July 27, 2017 - When you have pushed some commits to the remote repository and would like to undo those changes, you need to use the revert command to create a new commit, undoing all those changes.
Author   Kunal Chowdhury
Published   2017
Pages   466