Q. Will l have to pay state taxes in CA if I sell them before I move?
A. No.
Your interpretation of the rules is correct; for state tax purposes, a part year resident of two states reports the capital gain based on where he was living when the gain was "realized".