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

1 Answer

0 votes
by (20.8k points)

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 (32.2k points)
0 votes
asked Aug 24 in Git by JackTerrance (2.8k points)
0 votes
0 votes
asked Apr 18, 2020 in Git Slack Integration by SakshiSharma (32.2k points)