Create or update a commit by a specified author

Print Friendly, PDF & Email

You may have a situation where a repository is mirrored to multiple remote URLs. One of the URLs is on Bitbucket and the other one is based on GitLab for example. Both are not the same email. Here is the command to make a commit with a specific author.

  • Use git commit -m <message> to create a new commit with the specified <message>.
  • Use the --author option to change the <name> and <email> of the commit’s author.
git commit -m <message> --author="<name> <email>"
# Make some changes to files
git add .
git commit -m "Fix the network bug" --author="Tom Nguyen <tom.nguyen@itersdesktop.com>"
# Creates a commit by `Tom Nguyen`

This note will be recalled once I need to have a look at it again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.