How to undo git clicking on the wrong branch

I made changes to several files, made and pushed them to the wizard only in order to understand that I was on the wrong branch for commits and click. How can i undo this? I'm not sure if git reset will give me what I want.

+4
source share
1 answer

To not rewrite history, you can use git revert .

This will create a new commit, which is the inverse of the command that you accidentally pressed.

Find the bunch of commits you pressed and run this command for each step:

git revert <sha>

Then move the return commit.

+3
source

Source: https://habr.com/ru/post/1606814/


All Articles