How can we revert a commit that was pushed earlier and is public now?

We can use git revert command for this purpose.

Internally, git revert command creates a new commit with patches that reverse the changes done in previous commits.

The other option is to checkout a previous commit version and then commit it as a new commit.

Leave a Reply

Your email address will not be published. Required fields are marked *