11
eo2875
1y

Two brainfarts that resulted in... a lot of pain

I had been coding all day, ~6hrs. I was in the zone, so I hadn't saved to git. It was all uncommitted changes (you see where this is going...)

Brainfart#1: The code used the "Contact" class, but for some reason my hands typed "Product" in this ONE line.

Brainfart#2: I became aware of Brainfart#1, so I changed the variable from "Product" to "Contact". However, I instinctively pressed F2, "Rename Symbol", instead of just changing the variable I was using. Now ALL of the references to "Product" were to the "Contact" class instead, across all of our code.

I finished coding. I committed and pushed the changes, closed the IDE, and left the desk for a snack. When I came back, the automated tests were failing due to an import error. That's when I noticed my mistake. I couldn't do Ctrl+Z because I had closed the editor. I had to change the names one by one across all of our code. "Contact" and "Product" are probably our two most used classes 😭

Comments
  • 3
    What IDE are you using? I know a bunch that have their own file saving history and I just discovered it this year.
  • 1
    @c3r38r170 this message is sponsored by VSCode
  • 1
    @melezorus34 No te creas. Found it first on IntelliJ Idea. A couple days ago on VSCode.
  • 1
    @c3r38r170 oh rly? Sí, es VSCode. ¿Cómo se hace?
  • 3
    I did something similar but then i just performed a mixed git reset to the previous commit, looked through the diffs in PHPStorm's comfortable diff view and reverted the changes i didn't want selectively before finally commiting the fixed changeset.

    Thanks to git and a good IDE, what could have been really annoying and error prone to correct was just an hour of fine-grained cherry-picking.
  • 0
Add Comment