So often, we make the mistake of believing that sticking to good habits is an all-or-nothing game. (I say "we" because I've been there before as well.)
These beliefs are incorrect. Habits are behaviors that we repeat consistently. However, they are not behaviors that we repeat perfectly. This small idea -- that consistency does not require perfection -- is important.