I store my dotfiles in git like most these days, and recently had a mishap where I reverted to an older copy of
.config/git/config. There were a few days where I was committing with an email address no longer associated with my GitHub profile. Rebase to the rescue!
With just two configs, I was able to amend all my commits with the proper author info. Depending on what's changed, you might hit some edge cases...but rebase will generally give you friendly error messages with exact commands to fix and then
git rebase --continue.
HEAD~40 is just shorthand for "last 40 commits" so you might need to adjust that number. Take a look at
git log to figure out which commits to amend. Since this is the shortest post I've done in awhile (lucky you), if you don't already have something similar you might also want to add the following alias to your git config:
[alias] lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
That will give you nicer git log output (without clobbering the log subcommand), including color coding and branch indicators for easier reading:
* e5c45dc - (HEAD -> master, origin/master) freshen style (8 hours ago) <Mike Hoskins> * d1b7eb4 - freshen nav links; adjust font size (8 hours ago) <Mike Hoskins> * 28e3e2a - tweak colors, fonts and alignment (8 hours ago) <Mike Hoskins> * b81b89b - simplify (8 hours ago) <Mike Hoskins>
Update: There's also this, potentially less scary, non-rebase approach: https://help.github.com/en/github/using-git/changing-author-info