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 '
NEW_NAME="New Name Value"

' --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

Clippy: Deprecating `feature = "cargo-clippy"`

Since Clippy v0.0.97 and before it was shipped with rustup, Clippy implicitly added a feature = "cargo-clippy" config1 when linting your code with cargo clippy. Back in the day (2016) this was necessary to allow, warn or deny Clippy lints using attrib…

via Rust Blog February 28, 2024

Status update, February 2024

Hi! February is FOSDEM month, and as usual I’ve come to Brussels to meet with a lot of other FOSS developers and exchange ideas. I like to navigate between the buildings and along the hallways to find nice people to discuss with. This edition I’ve been invol…

via emersion February 20, 2024

Why Prusa is floundering, and how you can avoid their fate

Prusa is a 3D printer manufacturer which has a long history of being admired by the 3D printing community for high quality, open source printers. They have been struggling as of late, and came under criticism for making the firmware of their Mk4 printer non-…

via Drew DeVault's blog December 26, 2023

Generated by openring