Commit EVERYTHING

| Comments

To the mantra of Commit Early. Commit Often, I humbly submit Commit EVERYTHING.

When I was a wee young programmer and had my first experience with cvs, I was scared. Optimistic locking was mysterious. I only wanted to check in one teeny change at a time.

Eventually, I got comfortable and realized that committing my ENTIRE working copy is the only way to be sure I haven’t broken things.

Sins against this range from

“Shoot, I forgot to svn add that file before committing, sorry guys; One sec..”

to

“Well, I was keeping my own version for the last few weeks until I felt like it was really done.”

In the end, not committing your entire copy keeps you out of touch with the codebase and threatens stability. You leave yourself wide open to “Well, it works for ME”, when really you just have local changes you haven’t committed yet.

There’s a few ways to have your cake and still eat it. If you feel the urge to not commit everything, you might want to:

  1. Make your own experimental branch and work from that for a while (remember to merge in changes from trunk occasionally/)
  2. Commit more often, and in smaller chunks.
  3. Write enough tests so you can verify the integrity of the entire working copy before committing.

Too much pain and time is wasted when you need to decide which files are safe to check in, and which ones aren’t quite done yet.

blog comments powered by Disqus