What issue I've tried to solve
Some time ago, I set up a new VM to work on a new project, and after a few days of intensive work and multiple pushed commits, I figured out a typo in my email. Luckily, I've made commits to the dedicated feature branch, so I may fix it without disturbing the team
How to fix it
- Open the terminal (console, command prompt, etc.) and go to the source code folder.
- Switch to rebase mode
➜ git rebase -i HEAD~<N>
where <N>
is amount of commits from HEAD.
Or you may specify commit hash or branch
➜ git rebase -i 0893420285a5813ddd4a2c86f40054fa4968c9cf
➜ git rebase -i master
- Mark required commits to edit (with
e
letter) - Repeat required times
➜ git commit --amend --author="Vladislav Bochenin <vladislav.bochenin@email.com>" --no-edit
➜ git rebase --continue
- Check if everything is ok
➜ git log
- Push changes
➜ git push --force
Top comments (3)
A pretty good solution. Thanks for the post!
I'm grateful to the author for such an understandable and useful article. Waiting for the new posts, colleague!
Good text.