It is shown numerically and analytically that when an optical pulse approaches a moving temporal boundary across which the refractive index changes, it undergoes a temporal equivalent of reflection and refraction of optical beams at a spatial boundary. The main difference is that the role of angles is played by changes in the frequency. The frequency dependence of the dispersion of the material in which the pulse is propagating plays a fundamental role in determining the frequency shifts experienced by the reflected and refracted pulses. Our analytic expressions for these frequency shifts allow us to find the condition under which an analog of total internal reflection may occur at the temporal boundary.