Tech AI Insights

How to Change the Author Name of Your Last Git Commit

Step 1: Update the Author Name

Run the following command to amend the last commit with the correct author

git commit --amend --author="New Name <newemail@example.com>"

Step 2: Push the Changes (If Already Pushed)

If the commit is already pushed, force-push to update the remote:
git push --force

Warning: Force-pushing rewrites history, so check with your team before doing this.

Step 3: Avoid Future Mistakes

git config --global user.name "Your Name"

git config --global user.email "your-email@example.com"

That’s it! Your commit now has the correct author. 🚀

Scroll to Top