0 votes
in Git by
Is there a way to revert a git commit that’s already been pushed and made public?

1 Answer

0 votes
by

Yes, to fix or revert a bad commit, there are two approaches that can be used based upon the scenario.

They are:

The very obvious way is to make a fresh commit where you remove the bad file or fix the errors in it. Once done, you can push it to a remote repository.

Another approach is to create a new commit to undo all changes that were done in the previous bad commit. This can be done through git revert command – “git revert <name of bad commit>”

Related questions

0 votes
asked Feb 17, 2020 in Git by SakshiSharma
0 votes
asked Aug 24, 2023 in Git by JackTerrance
...