I made several commits and pushed them so, remote looks like this:
A-B-C-D---...--N
Commit B is of 4 modified files (a, b, c, d). I realized that I only want changes in file a, so I need to discard b,c,d changes. The problem is that I have already pushed the commit and made more commits that I have pushed as well. File a has been modified a lot in later commits. Problem is that when I click on Visual Studio 2022=> Manage branches => revert, only b and c file changes have been reverted, therefore a and d are still there. I get a pop up saying that it has been an error, but there is nothing on the output window. Question is: how do I do this using git bash?
CodePudding user response:
With git bash you find the sha of the commit (use a gui, or git log
), then you simply launch git revert <SHA>
This will create a new commit that revert the changes you made in the original commit.