1

Even though user.mail = mymail@test.com

In the course githowto the log looks like:

commit 911e8c91caeab8d30ad16d56746cbd6eef72dc4c
Author: Alexander Shvets <alex@githowto.com>
Date:   Wed Mar 9 10:27:54 2011 -0500

First Commit
Biffen
  • 6,249
  • 6
  • 28
  • 36
Alexander
  • 55
  • 7

1 Answers1

1

Just for one commit, as illustrated in "Change commit author at one specific commit", you need:

git commit --amend --author="Author Name <email@address.com>"

And of course, fix your setting:

git config --global user.email email@address.com

(email, not mail, as commented)


If you had more than one commit with the wrong email, you would need a filter-branch as shown here after setting the proper email (git config user.email, as commented)

git change-commits GIT_AUTHOR_EMAIL "new@email.com" HEAD~10..HEAD

(assuming here your last 10 commits are incorrect: adapt the number to your case)

Here, this is a simplified alias which forces the new value:

change-commits = "!f() { VAR=$1; NEW=$2; shift 2; git filter-branch --env-filter \"export $VAR='$NEW';" $@; }; f "

In both cases, if you have not pushed yet, that is OK: the amend or filter-branch will rewrite the existing commits, but you will still be able to do a regular push.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250