There are two ways of doing so:
By creating a new commit to undo all changes made by the commit that has already been pushed and made public. Following command is used for doing so:
git revert
By fixing or removing the bad file in a new commit and then pushing it to the remote repository. After making necessary changes to the file, commit it to the remote repository using the command:
git commit -m “commit message”