If you have multiple computers or multiple github accounts like I do sometimes you get the commits associated to the wrong account.
I'm currently in the middle of my 31 days of commits challenge and have done this a few times already. Each time I had to look up the set of commands for how to do this, so I figured I would just document it for the next time I need it.
Here we go
Check the git information:
git log
Alter multiple commits
Find that commit
Find the commits that you want update and then copy the next commit hash.
Start the rebase
git rebase -i -p <commit_hash>
If you haven't updated your default editor, you are in vi.
Don't be scared. I'll help you through this with the following commands:
-
i
to get into insert mode - use arrow keys to move around and change the words
pick
toedit
-
esc
to get out of insert mode -
:wq
to save and quit
Update each individual commit
git commit --amend --author="Your Name <email@email.com>" --no-edit
<enter>
git rebase --continue
<enter>
Verify things are changed
git log
Celebrate!
Top comments (0)