About a year ago Samuel Goodwin left a commit message of "Boyscouting". When I asked him about the commit he reminded me of the Boy Scouts motto [1]:

Leave it better than you found it.

Applied to development, this meant eliminating dead code, removing comments, and standardizing format. Samuel did this before he made changes.

Since then, I have tried to follow this practice [2]. It requires discipline. Not only in routine, but in restraint. It's tempting to add other changes to your "Boyscouting" commit.

It is important to understand boyscouting does not change code, only cleans it. Boyscouting is not refactoring. Boyscouting is not fixing bugs.

When in doubt, see if your boyscouting passes this test:

Would reverting the commit result in code loss?

If so, then you've done more than boyscouting. Commits are cheap. As shown in the screenshot, separate changes into their own commit.

Practicing something as simple as boyscouting not only improves the codebase, it improves my development. I no longer waste time on dead code or fixing formatting. Instead I can focus on making changes and use any extra time to improve the code further.

Share the practice of boyscouting with others as Samuel did with me. Boy Scout your code!

If you're wondering about the icons next to the commit hashes check out Mergeatron.

As pointed out by SwabTheDeck on reddit and Neal in the comments this is not the Boy Scout motto, but a passage left by Robert Stephenson Smyth Baden-Powell, founder of Scouting.

Upon researching the Boy Scout motto, I also came across The Boy Scout Rule in 97 Things Every Programmer Should Know.

Find this interesting? Let's continue the conversation on Twitter.