If using home-cooked beans, drain the 2 cups of cooked pinto beans and reserve the cooking liquid. If using a 15-ounce can, drain the beans and optionally reserve a little of the canning liquid to loosen the beans later.
Heat 1 tablespoon olive oil in a large skillet over medium heat until shimmering.
If using onion, add ½ cup chopped onion to the skillet and cook, stirring occasionally, until tender and translucent (about 4–6 minutes).
If using garlic, add 2 minced cloves and cook, stirring, for about 30–60 seconds until fragrant; do not let the garlic brown.
Add the drained beans, 1 teaspoon ground cumin, 1½ teaspoons kosher salt, and 1 teaspoon ground black pepper to the skillet. Stir to combine.
Cook, stirring occasionally, until the beans are heated through (about 3–5 minutes). Mash the beans in the skillet with a potato masher or the back of a wooden spoon to your desired texture. If the mixture is too dry, add a little of the reserved bean or canning liquid a small amount at a time until you reach the desired consistency.
Once the beans are at the texture and consistency you want and are heated through, remove the skillet from the heat and serve.