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

1 Answer

0 votes

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 Oct 30, 2022 in DevOps by Robindeniel
0 votes
asked May 21, 2020 by SakshiSharma
0 votes
asked Nov 24, 2020 in HDFS by rahuljain1
0 votes
asked Aug 16, 2020 in Git by RShastri