How to change the author of a git commit
If your coworker has made some updates to an existing git repo, and has asked you to update for them, you can update and push it to remote with their name as author instead of yours.
You have an existing git commit
Assuming you made the commit for a coworker and this commit is the last commit, and the name of the other author is XYZ and their email address is xyz@company.com, this is what you would do.
git commit --amend --author="XYZ <xyz@company.com>"
The editor opens and you may be prompted to save and close.
When you have done that, the author would have changed from you to XYZ.
Verify the commit author details
Run this to verify the commit author:
git log
You will be able to see the same git commit information, but with the author XYZ with their email address instead of yours.
Conclusion
If this has not worked for you, let me know via email or add a comment below. Thanks for reading.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.