The already pushed change, if people have pulled it, is something you'll have to live with. If no one's pulled it (i.e. you realize your mistake right after pushing), you can amend your commit:
git commit --amend
Make sure you don't add any new changes to the commit - don't use -a
, don't use git add
first. Then you can force the push, since this is a non-fast-forward change:
git push -f
If anyone's already pulled the commit with the incorrect name... this probably won't actually mess them up, since merging it with something containing the original commit should be easy; the patches are the same. However, if that person ever pushed back to your repo, they'd push that merge - along with the original commit on one side of it. Kind of defeats the purpose of renaming yourself if you end up with both names in the repo. (This is exactly the problem I described in my comment on the OP's answer.)