0

I have a repository shared with a contributor. Because of a mistake in the git config, I pushed many commits with different names and emails.

git shortlog -sne indicates the commit counts below. The red-marked entry is the other contributor, while the yellow-marked entries are my commits with two names and three emails. The last line is the correct combination, so I want to modify the other two to synchronize with the last one.

enter image description here

I have tried several ways which were suggested in other posts to override my previous commits, but all affected the number of commits in strange ways.

As an example, creating a file named .mailmap in the project directory with the following content

NameLine4 <MailLine4> NameLine3 <MailLine3>

and then running the command git filter-repo --force --mailmap .mailmap should sum the number of commits in the last two line, and show 59 NameLine4 <MailLine4>. However, it shows something completely different, by also modifying the other contributor's commits:

enter image description here

bbasaran
  • 364
  • 3
  • 15
  • Maybe the link I put at the top of your post will help. Warning: the solution shown there will completely change your entire git history. This will likely cause problems with merges from other contributors because they will still have the original history with the old emails. – Code-Apprentice Oct 26 '22 at 21:59
  • Note that the name and email aren't "credentials" because they are never used to authenticate. They are simply meta data on each commit to indicate who made the commit. – Code-Apprentice Oct 26 '22 at 22:00
  • I have seen many posts including that link, but none worked in my scenario. Let me edit the question to explain why I fail with those solutions. Thank you for your suggestion. – bbasaran Oct 27 '22 at 11:30

0 Answers0