The solution for me was to partition my work into hilariously small pieces. When I start a project from scratch, my first few tasks are "create the directory hierarchy," "create a repository," "Hello World," and "create exception-throwing stubs for the basic functionality." The idea is to finish early and finish often. If you can't commit a working version every day or two, you may be working on chunks that are too large.
It'll even sound better to your boss! Instead of saying, "no, I am not done," you can say, "I finished X,Y,Z, and W, and I am having trouble with S and R."