Save State Often

Developers: save state every chance you get!

It blows my mind that it still needs to be said, but I was prompted after hearing this: "We never got around to properly using source control, we just didn’t have the time."

Unfortunately, this situation is far too common among developers, especially those moving at a fast pace.

Here are some not-so-uncommon scenarios from my own career that could have been avoided with source control:

  • Having an idea that works, then tweaking it slightly without committing in between… only to realize you can’t get back to a working state.
  • Not pushing that branch, then re-cloning your repository due to a crazy mistake… only to realize you lost everything
  • Undoing changes for temporary testing… only to realize I didn’t save them before I started editing the file again.

But none of those relatively minor scenarios compare to my most shameful moment.

I was leading bringup on a three-component embedded system (I-BESS). We were preparing a customer demo of the data flow through our system. Finally, around midnight, we came up with a working solution! But we never saved state. And we had more fixes to land. Suddenly, in a 03:00 haze, we realized that we had managed to "fix" our way out of a working demo… By 09:00, we still had not slept and our customer saw a fragmented and unimpressive demo.

Had we simply taken seconds to save state, we could have reverted our "fixes" and saved the day. Instead we wasted a night and performed poorly the next day in front of our management and our customer.

Save state frequently. Push often. Never delete until you’re sure you’ve merged your changes to master.