← all posts

Deleting your deadname with git filter-repo

tl;dr:

  1. Install git filter-repo

  2. Clone the repository you want to fix up

  3. To change commit author metadata: create a file mailmap.txt, with contents like this:

    Your Name <name@example.net> Dead Name <dead@example.net>
    
  4. To change file contents (e.g. copyright notices): create a file replacements.txt, with contents like this:

    Dead Name==>Your Name
    dead@example.net==>name@example.net
    
  5. Run this command:

    git filter-repo --mailmap mailmap.txt --replace-text replacements.txt
    

This won't alter the commit timestamps (unlike a rebase), but it will still change the hashes, which will cause many problems if you run this on a repository that other people use.