git commit --amend --reset-author --no-edit
Here’s exactly what happens with that command:
--no-edit → keeps the old commit message
--reset-author → tells Git to overwrite the author of the commit with the current user
The current user is determined right now using the usual Git rules
Git will look for the author in this order:
Environment variables GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL (if both are set)
Otherwise, repository config user.name / user.email
Otherwise, global config user.name / user.email
If none of these are set, even with --reset-author --no-edit, Git will still abort with the famous error:
text*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Bottom line
Yes — you must have either:
Bashexport GIT_AUTHOR_NAME="Your Name"
export GIT_AUTHOR_EMAIL="you@example.com"
or
Bashgit config user.name "Your Name"
git config user.email "you@example.com"
(or the global equivalents) set before running git commit --amend --reset-author --no-edit.
Only if you use the form that explicitly supplies the author explicitly does Git not need them:
Bashgit commit --amend --author="New Name <new@email.com>" --no-edit
# This one works even if user.name/email are unset1.2sFast
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)