A small trick with git
I wish someone had told me this when I started. I ran into this again last week, so here is a short note for future me. The documentation was correct, I just did not read it carefully.
It is worth writing down the commands you only need twice a year. Measuring before changing anything saved me from a pointless rewrite.
There is probably a better way, but this one is easy to remember. After cleaning things up, the whole thing runs noticeably faster.
Naming things clearly helped more than any clever trick. Writing a tiny test first made the problem obvious.