Amending the author of a Git commit
ellie.wtf·75w
Preview
Report Post

It’s pretty common that I’ll accidentally use the wrong email for a commit. I have a few emails that I like to use for different purposes, so getting it correct is important :)

This one is nice and easy!

git commit --amend --author="Example Name <name@example.com>"

Using interactive rebase

  1. git rebase -i on whatever base you want
  2. Mark the commits you’d like to change with edit, instead of pick
  3. git commit --amend --author="Example Name <name@example.com>", then git rebase --continue

Using filter branch

Filter the whole thing! Be careful though, filter-branch can break things if you’re not careful

git filter-branch -f --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "old@email.com" ];
then
GIT_AUTHOR_NAME="New Name";
GIT_AUTHOR_EMAIL="ne...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help