On Deadnames and Git

Published 2021-03-09 on Cara's Blog - Permalink

Coming out is a hard thing no matter what form it takes. People who have known you for years or decades now need to reconcile the true you with the you that they’ve known for so long. This is hard enough for sexual orientations, but throw in new pronouns or a new name and the whole experience gets so much harder. There’s inevitably going to be stumbling blocks, either accidental or intentional, and part of coming out is learning to deal with these.

As a software engineer, I’ve been working with Git for many years1. In that time, a lot of stuff has changed. I’ve gone through three usernames (Oatmas64134->Otmas->Dev-Osmium->Muirrum), several emails, and quite a few organizations. One thing that’s been constant, however, has been the output of git config user.name. For more than six years now, that command has spat out my birth name. Up until recently, that was perfectly fine, but then I changed my name, and I started trying to scrub my deadname from as many places as I could.

Git by nature keeps a record of who made what change and when. These changelogs can be viewed by anyone who has the repository. While they can be changed, it’s usually considered bad form to change the history of a public repository. And on top of that, several organizations that I am not and will not be out to have my GitHub and see it regularly. I’ve been looking for a way to update my name across all git commits that I’ve made, but only in certain repositories.

This was an interesting problem. A few searches later and I came across this page on how to edit committer names. Scrolling down led me to this git filter-branch script

$ git filter-branch --env-filter '
WRONG_EMAIL="[email protected]"
NEW_NAME="New Name Value"
NEW_EMAIL="[email protected]"

' --tag-name-filter cat -- --branches --tags

This seems like a fairly simple script, and a review of the docs for git-filter-branch confirms this. What it also mentions, in a nice big “WARNING” paragraph at the top, is this:

       git filter-branch has a plethora of pitfalls that can produce
       non-obvious manglings of the intended history rewrite (and can leave
       you with little time to investigate such problems since it has such
       abysmal performance). These safety and performance issues cannot be
       backward compatibly fixed and as such, its use is not recommended.
       Please use an alternative history filtering tool such as git
       filter-repo[1]. If you still need to use git filter-branch, please
       carefully read the section called "SAFETY" (and the section called
       "PERFORMANCE") to learn about the land mines of filter-branch, and then
       vigilantly avoid as many of the hazards listed there as reasonably

Well then. More searching led to this repo for git filter-repo. I spent some time looking through the docs, and came across the --name-callback and --email-callback arguments. These take in python code and expect a return value. I threw together this oneliner to replace any instances of my deadname with my real name:

git filter-repo --name-callback 'return name.replace(b"$deadname", b"Cara")' \
	--email-callback 'return email.replace(b"$deadname", "cara")' \
	--message-callback 'return message.replace(b"$deadname", b"Cara")'

This worked perfectly, and I am now able to update my name across all repos I want to.

  1. I made my first GitHub repository in 2014 as Oatmas64134 ↩︎

Articles from my webring

How to write release notes

Release notes are a concept most of us are familiar with. When a new software release is prepared, the release notes tell you what changed, so you understand what you can expect and how to prepare for the update. They are also occasionally used to facilitate…

via Drew DeVault's blog May 19, 2021

Status update, May 2021

Hi! This month, a lot has happened in the Wayland world as usual. The most exciting news is the introduction of the new Pixman renderer in wlroots, allowing more Wayland compositors to be used on setups lacking a proper GPU or GPU driver. The use-cases includ…

via emersion May 18, 2021

Announcing Rustup 1.24.2

The rustup working group is happy to announce the release of rustup version 1.24.2. Rustup is the recommended tool to install Rust, a programming language that is empowering everyone to build reliable and efficient software. If you have a previous version …

via Rust Blog May 17, 2021

Generated by openring