I was talking to a friend who seemed to be independently rediscovering what he called self-referential motivation: motivating yourself to do something mostly based on the idea that doing it will strengthen your future ability to do things, and not doing it would weaken it, and the long-term effects from getting better at getting yourself to do things far outweigh the short-term difficulty of doing the thing. Then he asked me, "Didn't you write about that on the Beeminder blog? Is that the same idea?"
Here's the blog post he was talking about: Spiraling Into Control
Yes, it's the same idea, and it's not my idea, either. It's basically this guy George Ainsley's idea, who was the guy who discovered that pigeons (and other illogical animals like humans) follow hyperbolic discounting curves where short-term rewards matter exponentially more than long-term rewards, and that's usually why we are bad at making decisions, and you can hack this by choosing categorically based on what your choice will mean for future choices like it, and that basically that's all that willpower is: making internal rules which we can use to prioritize long-term desires over short-term ones.
The converse to that is that our short-term desires can also try to bend those internal rules so they can get what they want. These are called excuses, or rationalization, and the more we relent to them, the more likely we are in the future to give into similar excuses in similar situations.
So if you want to improve your willpower, your productivity, your reliability in your word to yourself, your ability to achieve your goals, your grit, whatever–you can do worse than to practice sticking to your own rules and achieving your goals. The practice of doing that is more important than the initial goals, actually. Success spirals is the technique of choosing easy initial goals and then gradually making them harder as you build up your trust in yourself to always succeed in your goal. If you always succeed and you never fail, then you can always make it a little harder, until you're doing very hard things and still always succeeding. There's more on this in the post above or in my book, but that's basically it, and it's the most useful motivation technique. Find ways to always do what you said you would do, at least in the categories where you are working on always succeeding. (You can't apply it to everything, as evidenced by my email inbox, but you can apply it to certain classes of goals that really matter.)