If you made a commit to a shared repo by accident and want to remove all traces, do a git reset –hard on the commit you want to reset to. The key is to FORCE push this to git.
Use this command wisely and sparingly though as it could play havoc with other team members. In fact, it’s safer to use only if you are the one who has access to a repo. For shared repos, you’ll want to use revert instead.