in Technology by

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

Please log in or register to answer this question.

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:

  1. 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.
  2. 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