1

So, our team has been working for several months on a project on Github. It turns out that one of our team members misconfigured his local git bash shell, and was commiting with an email address that had a typo in it.

The commits have already been pushed to the remote, and are fully ingrained into the history of the repository.

We tried the option of registering the misspelled email address and then associating it with his current GitHub account, but the email is part of a domain that no longer can be registered (an old Windows@live.com address), so this can't be done.

It's fairly important that we have access to the contribution stats of this team member, and we would also like to have the work publicly associated with his account for the purposes of building a portfolio.

Are there any options?

EDIT:

I ran the script mentioned at for this purpose in the questions linked in the comments of this post, but the author in questions commits have been replaced with soandsoemailname@10.100.220.47 rather than soandsoemailname@live.com. What gives? I want to know that this is correct before I force push and mess up everything.

Allen Luce
  • 7,859
  • 3
  • 40
  • 53
Bassinator
  • 1,682
  • 3
  • 23
  • 50
  • I think this one could help: https://stackoverflow.com/a/11768843/9041712 The original question is: https://stackoverflow.com/questions/2919878/git-rewrite-previous-commit-usernames-and-emails – Yu-Lin Chen Dec 06 '17 at 01:19
  • When I run this script, it replaces the author's email address with `soandsoemailname@10.100.220.47`, rather than `@live.com` as expected. What gives? – Bassinator Dec 06 '17 at 01:24

1 Answers1

0

This should have a similar effect to the script mentioned in Yu-Lin Chen's comment but makes it explicit on the command line. You might find it easier to avoid escaping/resolution problems with it:

git filter-branch -f --env-filter "if [[ \$GIT_AUTHOR_EMAIL = 'bademail@live.com' ]]; then GIT_AUTHOR_EMAIL=goodemail@live.com; fi" HEAD

You'll probably also want to rewrite the committer:

git filter-branch -f --env-filter "if [[ \$GIT_COMMITTER_EMAIL = 'bademail@live.com' ]]; then GIT_COMMITTER_EMAIL=goodemail@live.com; fi" HEAD
Allen Luce
  • 7,859
  • 3
  • 40
  • 53