IN LOVING MEMORY:

MY SNAKE PROGRAM, 2022/05/14 - 2022/05/15

Yesterday, I decided to write a snake program to practice using C. I decided to use a linked list to represent the parts of the snake, and to draw the graphics with ncurses. I finished the game within a day to the point where I was pretty happy with it. I had the idea to post my code to GitHub.

I had run git add . before editing my .gitignore to ignore my program’s binary. Before comitting, I wanted to unstage the binary. Not entirely caught up with my git knowledge, I tried to run git unstage *. Didn’t work.

I eventually found out that you can unstage files by running git rm --cached. Notice the flag at the end? --cached. In my infinite wisdom, I forgot to add that.

Long story short, I ran git rm -rf *. Not yet aware of my mistake, I ran ls and realized what I’d done: NO FILES existed in the directory. I tried every trick in the book to coax git into somehow restoring my project, but alas, I had not made the first commit yet. I had no luck.

The sad thing is, I was totally in the zone when I wrote that program. The code flowed smoothly and just seemed to work. Even if it wasn’t the most readable thing in the world, in the moment, it felt artisan-crafted. And now it’s gone.

From this point on, every program I write will be TWICE as great as the snake program lost to the void.

Godspeed, my fellow programmers. May your backups be reliable and your pointers always be != NULL.