DEV Community

Petros Amoiridis
Petros Amoiridis

Posted on

Git amend and reset author

You may have ended up with multiple wrong authors in your last commit. Sometimes, squashing or rebasing can do that. When the commit is the most recent one, it's as easy as:

git --amend --reset-author
Enter fullscreen mode Exit fullscreen mode

That will open up the default editor and allow you to add more co-authors if needed. But if that's not what you want you can skip the editing with:

git --amend --reset-author --no-edit
Enter fullscreen mode Exit fullscreen mode

Please note that this will get the author information from your global or local git config. If that's wrong, you may want to adjust it before you run the suggested command above.

Please also note, that this will need a force push if the branch is already published. Which means you need to talk to any other collaborators that also work on the same branch.

Top comments (0)