How to remove an unpushed outgoing commit in Visual Studio?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

How to remove an unpushed outgoing commit in Visual Studio?

Message par Clippy »

How to remove an unpushed outgoing commit in Visual Studio?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: How to remove an unpushed outgoing commit in Visual Studio?

Message par Clippy »

Open the history tab in Team Explorer from the Branches tile (right-click your branch). Then in the history right-click the commit ***before*** the one you don't want to push, choose Reset. That will move the branch back to that commit and should get rid of the extra commit you made. **In order to reset before a given commit you thus have to select its parent.**

[](https://i.sstatic.net/VRHRI.png)

Depending on what you want to do with the changes choose **hard**, which will get rid of them locally. Or choose **soft** which will undo the commit but will leave your working directory with the changes in your discarded commit.
Répondre

Revenir à « Visual Studio & VS Code »