We consider the stack of stable curves of genus g with a given dual graph and we give an explicit desingularization of its closure in the moduli stack of stable curves. We study in particular the one-dimensional substack of curves with at least 3g-4 nodes.