Go across the Bay Bridge, then take I-580 toward Hayward. Stay on 580 through the Livermore Valley and over the Altamont Pass. Just before Tracy, take the I-205 cutoff toward Manteca. Just before Manteca, take CA120. Stay on 120 all the way through Oakdale, Big Oak Flat, and Buck Meadows, all the way into Yosemite. If you're staying in El Portal (sounds like it?), you'll actually need to enter the park, then turn around at the beginning of the Valley to go back out on 140 to El Portal.
I'm sure you'll pass lots of them as you traverse the Bay area on freeways. Oakland, San Leandro, Pleasanton, and Livermore are all large cities. Tracy and Manteca are reasonable size, and should have lots of groceries too. Oakdale should have some. But once you pass Oakdale, you'll be more out in the country, and will have slim pickings after that.