Hope you’ve introductory knowledge of git, if not you can refer to one of my git intro blog :trollface:

So we know things till git push which is pretty simple, lets get little deep where we can deal with some real life scenarios where we might have messed up and want to make things write.

Checked in with wrong email address/name

First thing, setup proper email and name so you won’t make the same mistake again. Little flashback to know how you can…

git config user.email "your@email.address"
git config user.name "Iron Man"

now lets correct our mistake, that we commited with wrong email. You can confirm it with git log that what email was used for that commit. In the below example I made a mistake and checked-in with wrong email.

image with wrong email in commit

If it was the last commit then below command will resolve your issue. It ammends your last commit and updates the author, later you can push it to remote repository.

git commit --amend --author="Saurabh Londhe <saurabh@domain.com>"

If you already pushed it to remote then you might need to push it forcefully

git push origin master -f