delete all ignored files
This will remove all ignored files effectively resetting your current state to a fresh clone.
git clean -dfX
committed to wrong branch
This will revert the commit, but put the committed changes back into your index.
Then you can switch to the correct branch and make the commit again:
git reset --soft HEAD^
amend last commit
Allows you to change the message or contents of your last (unpushed) commit:
git amend
If you accidentally amend you can undo it with:
git reset --soft HEAD@{1}
Git doesn't actually "replace" the old commit. It writes a new commit which also
points from the old commits parent. Then it updates your branch to follow the
new commit. So where is the old "overwritten" commit?
git log --graph --oneline --reflog
For older commits you can arbitrarily change them quickly with git rebase.