Yes, to fix or revert a bad commit, there are two approaches that can be used based upon the scenario.
- 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>”