Let's start with petty theft
Petty theft is the taking of property valued at under $950 (the law recently changed from $400 to $950 as the line between grand and petty theft). While there is a section that makes theft of property under $50 from a retailer an infraction, any amount of theft, from a penny up to $950 can be charged by the prosecution as a misdemeanor petty theft. Petty theft carries up to 6 months in county jail and/or a thousand dollar fine.
In general, grand theft is taking of property over $950 in value. It can be charged by the prosecution as either a felony or a misdemeanor. As a felony, it carries a maximum of 3 years in state prison and as a misdemeanor, up to a year in county jail. There are some other types of grand theft where the property value is less - Over $250 of agricultural or aquacultural products and certain livestock. Theft of property from a person (for example, pickpocketing) of any amount is grand theft. Theft of a firearm of any value is grand theft. Theft of a motor vehicle of any amount is grand theft.
Petty theft with a prior
If you have a three prior theft convictions (prior petty theft, grand theft, robbery, motor vehicle theft, etc) and were sentenced to at least one day in jail on one of your prior case, then you commit a new petty theft offense, the prosecution can charge you with Penal Code section 666 - petty theft with a prior. It doesn't matter how long ago the priors were. Petty theft with a prior is a "wobbler," meaning it can be charged as a felony (up to 3 years in state prison) or a misdemeanor (up to a year in county jail).
But what will happen to ME?
Every case is unique. Often, your attorney can work out an arrangement to try and avoid a conviction. This may involve a diversion or "deferred entry of judgment" plea where you are ordered to attend classes, do community service or other punishment in exchange for being able to have your case dismissed. If you're unable to avoid a conviction, any sentence will depend on the particular facts of your case, your record, the judge, the jurisdiction, the DA and your attorney.