So I stupidly made 3 commits on a machine that was not configured for git (no author or email) and I want to change those 3 commits (have not been pushed) authors to what they are suppose to be.
I know git commit --amend
can change the author, but how can I do it to 3? I know rebase can change the message. Is there a way to change author?
You can use interactive rebase. The answer from this post gives you an example: How to change the commit author for one specific commit?. The author asks for changing author at a specific commit, but interactive rebasing can be used to change authors of multiple commits if you edit all commits that you wish to change.
The git commit --amend --reset-author --no-edit command is especially useful if you created commits with the wrong author information, then set the correct author after-the-fact via git config .
You can use interactive rebase. The answer from this post gives you an example: How to change the commit author for one specific commit?.
In particular, you can do the following to change one specific commit:
git commit --amend --author="Author Name <[email protected]>" --no-edit
The author asks for changing author at a specific commit, but interactive rebasing can be used to change authors of multiple commits if you edit
all commits that you wish to change.
Other potential useful techniques related to interactive rebasing could be found in the Pro Git book http://git-scm.com/book/en/Git-Tools-Rewriting-History, including squashing, redordering, editing messages, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With