Mentioned a while ago here was a "martini method", and I realized the above after I started using that a few weeks ago. For review, the modified version of the method I proposed is just to do
while true
do
echo -n `date` " "
svn diff | wc -l
# or git diff -- I'm going to switch to git soon
sleep 600
done
and exercise as much self-control as possible to avoid some specific set of timewasting or otherwise enjoyable activities (traditionally, drinking a martini) until the diff reaches a certain length. (Occasionally I give myself a break if I just came off a hugely productive run the previous day, or if I'm just wiped out from my day job.)However, I accidentally set what turned out to be ridiculously low limits (because of the extra metainformation and surrounding lines of code that svn diff prints out). As it turned out, I didn't need to revise the limits upward, because it turned out I was frequently (not always, but that doesn't matter) staying engrossed in the task long after I'd reached the limit. I realized that it was enough to create an incentive to reach that easy goal, just to get me to switch to the task.
The best part is that I never sit down feeling like I've got some insurmountable pile of work I have to do, even though the project I'm working on as a whole is much larger than I'll ever be able to do by myself. When I task-switch, I'm just focused on thinking of what little piece I can do next. I _can_, if I want, make a few small scattered trivial changes, and I'm done for the day, but usually it's enough to get me thinking about the code, so I usually stay at the keyboard.
The fact that the goal is so easy to reach also makes self-control a lot easier. It's really no big deal if I feel like vegging for the whole evening -- I just have to do a smidge of work first. And I usually find after I've taken that first little step that I wasn't as tired as I thought I was.