Doing bad in undergraduate but good in a masters program Suppose you do bad in undergraduate school in say computer science. But you do very well in a masters program in computer science. If you want to apply to a PhD program in computer science, will the masters degree grades offset the undergraduate degree grades?
Sort of.

I was in exactly the situation you describe 20+ years ago.  My undergrad GPA was horrible (even restricted to computer science classes); my MS GPA was near-perfect; I got into Berkeley as a PhD student.  But I don't think the improvement in my grades was as important as the improvement in my letters.  My undergrad letters said "He's smart but lazy", which is the kiss of death.  My MS letters were much more positive.  Also, when I applied to Berkeley, I had some research results in submission, so my positive letters had some substance to draw on.

Also, I got very, very, very lucky.

Now, as a faculty member who reviews PhD applications, I would certainly look at the improvement in grades as a good sign.  But as I've mentioned elsewhere, above a certain threshold of "good enough", grades don't matter.  Especially since you're applying with a master's degree, your demonstrated research ability is much more important.