If you found a bug in your last commit, you can simply recommit the last commit with
git commit --amend
@aragaer 's comment is even shorter way of doing the same:
git commit -a --fixup=HEAD^ #(or whatever commit to be fixed)
git rebase -i HEAD~3
and you don't need to change anything, so you can just close editor and
git will handle the fixup itself.