Changing History with git-filter-repo
I have used
to synchronize work between several different devices and across several different platforms for quite some time now. Over the years, though, inconsistencies have crept in. The name attached to my commit messages, for example, might be “Zac” on one device, “Zachary Szewczyk” on another, and “Zac Szewczyk” when committing via GitLab’s web editor. The same applied to the email address attached to those messages. Elijah Newren’s git-filter-repo project made it a breeze to fix this.
Based on a helpful StackOverflow post, I put together a quick script called
to rewrite my commit history. For each incorrect email address, it contained a stanza like the one below:
I also took this opportunity to remove references to a few sensitive files from my repositories as well.
made that easy, too. GitHub even recommends Elijah’s tool in its official documentation.
A few minutes later, I re-uploaded my fixed repositories to GitHub: