Real-time in situ X-ray diffraction of intercalation reactions